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:
'App\Migrations': '%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?
php bin/console debug:config doctrine_migrations
Current configuration for extension with alias "doctrine_migrations"
================================================================= ===
doctrine_migrations:
migrations_paths:
App\Migrations: /var/www/src/Migrations
services: { }
factories: { }
storage:
table_storage:
table_name: null
version_column_name: null
version_column_length: null
executed_at_column_name: null
execution_time_column_name: null
migrations: { }
connection: null
em: null
all_or_nothing: false
check_database_platform: true
custom_template: null
organize_migrations: false