Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kschusternetformic opened this issue Feb 8, 2022 · 1 comment

Comments

@kschusternetformic
Copy link

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)%'
@RobinBrackez
Copy link

RobinBrackez commented Mar 14, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants