Reputation: 453
I am trying to run migrations on a Symfony 4 application with a total of 271 migrations. However, when doing so it skips the first 41 migrations (the first is Version20180921083101).
>>> php bin/console doctrine:migrations:status
== Configuration
>> Name: Application Migrations
>> Database Driver: pdo_mysql
>> Database Host: db
>> Database Name: test
>> Configuration Source: manually configured
>> Version Table Name: migration_versions
>> Version Column Name: version
>> Migrations Namespace: DoctrineMigrations
>> Migrations Directory: /var/www/src/Migrations
>> Previous Version: Already at first version
>> Current Version: 0
>> Next Version: 2018-11-14 06:38:03 (20181114063803)
>> Latest Version: 2020-01-27 05:06:49 (20200127050649)
>> Executed Migrations: 0
>> Executed Unavailable Migrations: 0
>> Available Migrations: 230
>> New Migrations: 230
I am been trying to update the schema, clear cache, and dropped/recreated the database, but without success. I have also tried to execute only the first one by running the following command:
>>> php bin/console doctrine:migrations:migrate Version20180921083101
Application Migrations
Unknown version: Version20180921083101
It seems that those versions prior to Version20181114063803 cannot be recognized. I have been struggling with this issue for a while now and running out of things to try so any help or pointers would be highly appreciated. Thanks!
Upvotes: 3
Views: 7764
Reputation: 29
Problem might come from migrations executed from different branches before everything was merged together. If my memory is correct Symfony saves the last migration executed in your current database, if migrations comes from other branches with previous timestamp, they will not be executed with the doctrine:migrations:migrate command.
Upvotes: 0
Reputation: 21
If you use Symfony v.4 and want to execute one migration, you should use the next command
php bin/console doctrine:migrations:execute --up 20180921083101
Upvotes: 2
Reputation: 85
For me the problem was that i was running
php bin/console doctrine:migrations:migrate 'DoctrineMigrations\Version20210403042222'
Instead of
php bin/console doctrine:migrations:migrate DoctrineMigrations\Version20210403042222
No single quotes, although the example in the docs uses single quotes.
So for the initial post, i think you just need to add the namespace without any quotes:
php bin/console doctrine:migrations:migrate DoctrineMigrations/Version20180921083101
Upvotes: 4
Reputation: 11
I got the same problem after an update of the doctrine_migration bundle. In my case the Error wasn't really accurate, in fact it was more a problem of "it wasn't recognized as a valid migration" than a real not found issue so I put it there in case someone encounter the same situation.
Adding the following missing function solved my issue:
public function getDescription() : string
{
return 'Your description';
}
Upvotes: 1