What is a Migration in Laravel?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid Laravel basics — a prerequisite for any developer role.

Answer

Migrations are like version control for your database schema. Instead of writing raw SQL, you define schema changes in PHP using Laravel's Schema Builder. Generate: php artisan make:migration create_users_table. Each migration has an up() method (apply changes) and a down() method (rollback). Run: php artisan migrate. Rollback: php artisan migrate:rollback. Migrations allow your team to share and synchronize the database structure — the schema is in version control alongside the code. The migrations table tracks which migrations have been run. Use php artisan migrate:fresh --seed during development to reset and re-seed the database.

Pro Tip

Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex Laravel answers easy to follow.