Open MikelAlejoBR opened 3 years ago
hmm this is interesting. it seems that we should always prefer the connection setting when running migrations, while we should only consider the entity manager connection while generating migrations.
did anyone manage to resolve this?
Bug Report
Summary
Even if many connections are configured, Doctrine doesn't use the specified connection in the
doctrine_migrations.yaml
file. Possibly related to https://github.com/doctrine/migrations/issues/1062 .Current behavior
When running
php bin/console doctrine:migrations:migrate
, the command returns the following error:I have tried allowing the regular user to create the
doctrine_migration_versions
table, as I suspected that maybe the issue had something to do with that. But with no luck. Reproducible with the following commands:GRANT ALL PRIVILEGES ON SCHEMA application TO all privileges on schema application to app_user
php bin/console doctrine:migrations:migrate
REVOKE ALL PRIVILEGES ON SCHEMA application FROM app_user;
php bin/console doctrine:migrations:migrate
How to reproduce
docker-compose up
and try to runphp bin/console doctrine:migrations:migrate
.Otherwise, the manual steps are:
Create a pair of users in that database, one with only
USAGE
privileges with the following script:symfony new --full mybugtest
Configure the connections in
config/packages/doctrine.yaml
:.env
file:manager
connection inconfig/packages/doctrine_migrations.yaml
:php bin/console doctrine:migrations:migrate
Expected behavior
The
doctrine_migration_versions
table is created, and the corresponding migrations run with the specified connection in thedoctrine_migrations.yml
file.