🔴 Laravel
Beginner
What is a Migration in Laravel?
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.