Rollback one specific migration in Laravel
Solution 1:
Laravel 5.3+
Rollback one step. Natively.
php artisan migrate:rollback --step=1
And here's the manual page: docs.
Laravel 5.2 and before
No way to do without some hassle. For details, check Martin Bean's answer.
Solution 2:
If you look in your migrations
table, then you’ll see each migration has a batch number. So when you roll back, it rolls back each migration that was part of the last batch.
If you only want to roll back the very last migration, then just increment the batch number by one. Then next time you run the rollback
command, it’ll only roll back that one migration as it’s in a “batch” of its own.
Alternatively, from Laravel 5.3 onwards, you can just run:
php artisan migrate:rollback --step=1
That will rollback the last migration, no matter what its batch number is.
Solution 3:
Every time you rollback you get the last batch of migration. use the command
php artisan migrate:rollback --step=1
Solution 4:
better to used refresh migrate
You may rollback & re-migrate a limited number of migrations by providing the step option to the refresh command. For example, the following command will rollback & re-migrate the last two migrations:
php artisan migrate:refresh --step=2
otherwise used rollback migrate
You may rollback a limited number of migrations by providing the step option to the rollback command. For example, the following command will rollback the last three migrations:
php artisan migrate:rollback --step=3
for more detail about migration see