Rollback Your Database Migration in Laravel

Hi artisan now i am going to discuss about laravel database migration. So this example is going to focus on how to rollback migration in laravel. I wanna share with you how to revert migration in laravel. That mearn basicallly I’m going to show you about laravel migration rollback example.

So i hope you can understand a concept of laravel migration rollback step 1. I will share simple example of how to rollback database migration using laravel migrate command. So hope you can use this commands with laravel 6, laravel 7 and laravel 8 version in your running application.


Create Table

We need table to test our database rollback command. So create those below tables

php artisan make:migration create_posts_table
php artisan make:migration create_items_table
php artisan make:migration create_products_table



Now migrate and create another table to test database rollback. So create it

php artisan make:migration create_football_table




Rollback Last Migration

Now you can rollback your last migration by the following command like below

php artisan migrate:rollback


After running the following command you will see the below output



Rollback Last Migrations with Step:

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

php artisan migrate:rollback --step=2


After running the following command you will see the below output




Rollback All Migrations:

You can also rollback your all migration. So just 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






Recommended : Build a SPA Authentication using Laravel Sanctum


Hope it can help you.


Facebook Github
A web enthusiastic, self-motivated Full-Stack Web Developer from Dhaka, Bangladesh with experience in developing applications using Laravel Vue and React Js Application.