How to Rollback Migration in Laravel?

By Hardik Savani April 16, 2024 Category : Laravel

This example is focused on how to rollback migration in laravel. i would like to share with you how to revert migration in laravel. I’m going to show you about laravel migration rollback example. you can understand a concept of laravel migration rollback step 1.

i will simple example of how to rollback database migration using laravel migrate command. you can also migrate specific migration using step argument, also you can migrate rollback all migrations. let's see very simple examples how migration rollback is working.

you can use this commands with laravel 6, laravel 7, laravel 8, laravel 9, laravel 10 and laravel 11 version.

Created New Migrations:

php artisan make:migration create_posts_table

php artisan make:migration create_items_table

php artisan make:migration create_products_table

Rollback Last Migration:

php artisan migrate:rollback

Rollback Last Migrations using Step:

you can pass --step option with rollback number of migration from last. here it will rollback last two migration.

php artisan migrate:rollback --step=2

Rollback All Migrations:

rollback all means it will reset all migration. so if you change anything on migration file then it will recreate and affect it.

php artisan migrate:reset

i hope it can help you...