Sometimes after migrating in Laravel, we need to rollback our database migration like step 1 or step 2 or sometimes we need to rollback a specific migration. Now in this tutorial, I will show you how to rollback all the migrations in laravel.
Laravel provides migrate:rollback
command to rollback your database migration. We can pass a step with this command that how many steps we would like to rollback. Let's see the example code of laravel rollback last migration.
php artisan migrate:rollback
Read also: Rollback One Specific Migration In Laravel Example
We can roll back a limited number of migrations by providing the step
option to the rollback
command.
php artisan migrate:rollback --step=2
The migrate:reset
command will roll back all of our application's migrations:
php artisan migrate:reset
Read also: Laravel 9 Refresh Specific Migration Example
Conclusion
I have tried to discuss the clear concept of laravel rollback migration. Now we know laravel rollback last migration. Hope this how to rollback in laravel tutorial will help you.