As per laravel doc, To rollback the latest migration operation, you may use the rollback command. This command rolls back the last "batch" of migrations, which may include multiple migration files:
php artisan migrate:rollback
You may rollback a limited number of migrations by providing the step option to the rollback command. For example, the following command will rollback the last five migrations:
php artisan migrate:rollback --step=5
The migrate:reset command will roll back all of your application's migrations:
php artisan migrate:reset
You can check here. But i need to remove the specific migration file. As per my project having 30-40 migration file. I want to remove one of the migration file and its model. Is there any way to do this or have to do it manually.
Don’t. Migrations are version control for your database. “Removing” a particular migration is like removing a random commit from your Git repository’s history: it can have terrible consequences.
Instead, if you no longer need a table, then create a new migration that drops that table in the up
method, and recreates it in the down
method so the migration can be rolled back.
Delete the migration file, remove the table from the database, and also remove that file name from migrations
table in the database.
Sometimes, doing things manually is the best way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With