Tuesday, 15 May 2012

Do Laravel 4 migration rollbacks execute in reverse order? -



Do Laravel 4 migration rollbacks execute in reverse order? -

i checked docs can't confirm this: if run php artisan migrate:rollback, various down() command run in reverse order? example, if have migration files:

2014-07-01_first_migration.php 2014-07-01_second_migration.php 2014-07-01_third_migration.php

does rolling fire thirdmigration->down(), secondmigration->down(), , firstmigration->down()?

the short reply yes, how works.

the longer reply yes - because migration might include things such adding column table. if didnt run them in reverse order, table removed before column removed!

there few ways reverse migrations. reverse lastly migration operation:

php artisan migrate:rollback

and reverse all migrations initial db:

php artisan migrate:reset

laravel migration

No comments:

Post a Comment