Previously executed migration are not registered migrations
Solution 1
This is a year old, but I've had problems a few times where I delete old migration files because they aren't relevant or whatever reason and had the same issue. I think the correct way to handle this is to delete references from the table directly.
php bin/console doctrine:query:sql "delete from migration_versions where version = '2020181217104204'";
EDIT - newer versions of Symfony are now using a "doctrine_migration_versions" table.
php bin/console doctrine:query:sql "delete from doctrine_migration_versions where version = '2020181217104204'";
Etc..
Solution 2
Encounterd the same probleme : I had previously copied already executed migration to the newly created migration table (due to doctrine update).
Renaming all version names as follow saved the day : 20190408092436 --> DoctrineMigrations\Version20190408092436
Minirock
Updated on June 18, 2022Comments
-
Minirock almost 2 years
I'm trying to update my database with those commands
php bin/console make:migration
this return success
But when I try
php bin/console doctrine:migrations:migrate
I have this error:
WARNING! You have 5 previously executed migrations in the database >>that are not registered migrations.
>> 2018-12-17 10:42:04 (20181217104204) >> 2018-12-17 13:19:24 (20181217131924) >> 2018-12-17 13:40:58 (20181217134058) >> 2018-12-18 10:41:38 (20181218104138) >> 2018-12-18 13:15:49 (20181218131549)
Thing is, the database listed here are not in my migrations table from my database and they are not in my Migrations folder either.
How can I remove those wrong migrations ? Thanks.
-
RyanH about 3 yearsThis was exactly what I was looking for! After recently updating to Symfony 4, the migrations bundle now requires the new naming of entires in the migrations table. Cheers !