Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Rolling Back migration in Laravel.

Rollback command is used to rollback the last migration means remove the last migration from the database. Laravel provides different commands to rollback tables from the database, these are:-

1. php artisan migrate:rollback :- It rollback the last migration we have migrated. See below:-

2. php artisan migrate:rollback –step=(No.-of-migrations) :- It rollback the limited number of last migrations (no. is provided after step) from the database. See below:-

In the above example, Step=3 means it rollback last 3 migrations. So after the execution of command as you see that last 3 migrations are rollbacked.

3. php artisan migrate:reset :- It will rollback all the migrations from the database with only one command.

4. php artisan migrate:refresh :- After calling refresh, it first rollback all the migrations and then execute migrate command automatically. This command effectively re-creates your entire database. See below:-