The version "latest" couldn’t be reached, there are no registered migrations (Symfony, Doctrine, 2020)

So I’m setting up a Symfony 5 project and running the following commands to generate the database from entity annotations like this:

php bin/console doctrine:schema:validate
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

But it’s not working as expected, and instead I’m just getting this error:

**[ERROR]** The version "latest" couldn't be reached, there are no registered migrations.

The diff command correctly generates the migration file containing the up() and down() functions however when I subsequently run the migrate command to generate the database it fails with the above error.

I also notice the file /config/packages/doctrine_migrations.yml has changed recently to this:

doctrine_migrations:
migrations_paths:
    'AppMigrations': '%kernel.project_dir%/src/Migrations'

However it appears doctrine is looking outside this path for the migrations in the following path:

'%kernel.project_dir%/migrations'

How do you resolve the above error so that the migrate command works as expected and generates the database tables from the generated migration file?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *