MWZ

MINDWAREZONE

beginnerLaravel

How do you create and run migrations?

Answer

Clear, interview-ready explanation

Create a migration with php artisan make:migration followed by a descriptive name, for example create_orders_table. Laravel places the generated migration in database/migrations with a timestamp that determines execution order.

Define the schema changes in the migration’s up method, optionally define the reverse in down, then run php artisan migrate. Laravel executes pending migrations and records them. A deployment should run migrations as a controlled, reviewed step with backups and a compatible application release.