Recall & Review
beginner
What command do you use to run all pending migrations in Laravel?
Use
php artisan migrate to run all migrations that have not been applied yet. This updates your database schema to the latest version.Click to reveal answer
beginner
How do you rollback the last batch of migrations in Laravel?
Use
php artisan migrate:rollback to undo the last batch of migrations that were run. This helps if you want to revert recent database changes.Click to reveal answer
intermediate
What does the
migrate:reset command do?The
php artisan migrate:reset command rolls back all migrations, undoing all database schema changes made by migrations.Click to reveal answer
intermediate
How can you rollback and then re-run all migrations in one command?
Use
php artisan migrate:refresh. It rolls back all migrations and then runs them again, useful for rebuilding the database schema from scratch.Click to reveal answer
beginner
Why is it important to run migrations carefully in a team environment?
Because migrations change the database structure, running them without coordination can cause conflicts or data loss. Teams should communicate and use version control to keep migrations in sync.
Click to reveal answer
Which command runs all new migrations in Laravel?
✗ Incorrect
The
php artisan migrate command applies all pending migrations.What does
php artisan migrate:rollback do?✗ Incorrect
It undoes the last batch of migrations that were applied.
Which command rolls back all migrations at once?
✗ Incorrect
migrate:reset rolls back all migrations.How do you rollback and re-run all migrations in one step?
✗ Incorrect
migrate:refresh rolls back all migrations and runs them again.Why should teams coordinate when running migrations?
✗ Incorrect
Coordination prevents conflicts and data loss when multiple people change the database.
Explain how to run migrations and rollback the last batch in Laravel.
Think about commands to apply and undo changes.
You got /2 concepts.
Describe the difference between migrate:reset and migrate:refresh commands.
One just undoes, the other undoes and reapplies.
You got /2 concepts.