Remove last added migration in Laravel
In laravel, there is no command to remove migration but hopefully, there is a rollback command. Let's see how to use the rollback command if we accidentally created a migration or we decided to remove the last migration.
The first step is to find the migration file from app/database/migrations/migration_file_you_want_to_delete.php
now delete it from from the migrations folder.
Then run composer dump_autoload to reset the composer autoload files.
That was easy, right?.
Now, what if you have already given the create migration command ie.php artisan migrate: make users? Don't worry . its simple just like the above steps.
1. Delete the migration file which you want to delete from app/database/migrations/.
2. Run composer dump_autoload command.
3. Make necessary changes in the database and remove last created migration from the migrations table.
Comments
0 comments
Please Sign in or Create an account to Post Comments