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

postgres schema is redirected when only a pdo connection is given in config #434

Open
1 task done
kimberv opened this issue Feb 18, 2020 · 1 comment
Open
1 task done
Labels

Comments

@kimberv
Copy link

kimberv commented Feb 18, 2020

This is a (multiple allowed):

  • bug

Using latest phinx 0.11.4

  • CakePHP Version: 3.8.9
  • Database server Postgres: 12.1
  • PHP Version: 7.4
  • Platform / OS: docker bref php

What you did

(This is pulled from an issue card created on phinx, I was directed to post the issue here.)

I use postgres with multiple schemas in one database, and I hand in my pdo connection via phinx config.connection rather than specify dsn settings.

Expected Behavior

I expect phinx/cake/whoever to trust the pdo connection I hand in, without messing with it.

Actual Behavior

On line 63 of CakeAdapter, code is resetting schema to public if config.schema is not given. The easy workaround is to specify schema in the config, but it seems unnecessary. Preferred would be that, if I hand phinx a pdo connection via config, it would trust it and leave it alone. An uneducated suggestion would be to change line 63 to something like:

     if (!isset($config['connection']) && $connection->getDriver() instanceof Postgres) {
@dereuromark
Copy link
Member

PR welcome.

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

No branches or pull requests

2 participants