doctrine/DoctrineMigrationsBundle

Migration console command does not respect dbname_suffix when replica configuration is used

kschusternetformic opened this issue · 1 comments

The dbname_suffix is being ignored, even when a connection is specified. Config used:

config/packages/doctrine.yaml

doctrine:
  dbal:
    default_connection: default
    connections:
      default:
        url: '%env(resolve:DATABASE_URL_WRITER)%'
        server_version: '13.4'
        driver: pdo_pgsql
        replicas:
          replica1:
            url: '%env(DATABASE_URL_READER)%'

config/packages/test/doctrine.yaml

doctrine:
  dbal:
    connections:
      default:
        dbname_suffix: '_test%env(default::TEST_TOKEN)%'
        replicas:
          replica1:
            dbname_suffix: '_test%env(default::TEST_TOKEN)%'

I have the same issue. Is there any workaround?

./bin/console doctrine:database:create --env=test
=> creates 'app_test'

./bin/console doctrine:migrations:migrate --env=test
=> uses 'app'

same for fixtures, that also uses just 'app'

Edit:

for anyone wondering, I fixed it this way:

when@prod:
    doctrine:
        dbal:
            connections:
                default:
                    replicas:
                        replica1:
                            url: '%env(resolve:DATABASE_READ_URL)%'

This only sets the replica url in production, not in the test-env.