I created few migrations and migrated them, after that I deleted them manually without rolling back.
and now I want to rollback other migrations but I'm getting an error that migration not found referring to the last migration I had deleted, even when I rollback a specefic migration with a --path
I still get
migration not found: name_of_the_last_migration_I deleted_manually
with referring the last migration I deleted manually.
CodePudding user response:
The migrations are stored to a table (called "migrations") in your database. When you run a migration, it is added to that table - using the rollback function looks at the latest migration in the table and runs the down() function for it.
If you reverse a migration manually (ie. deleting the table or columns that the migration created) but then try to use the rollback function, it will fail because the migration cannot remove columns / tables that have already been removed.
So the answer is to delete the migration(s) that you have reversed from the migrations table.