How to Rollback Migration in Laravel?

By Hardik Savani | April 26, 2021 | 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 and laravel 8 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...

Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: