If you have a schema which contains characters which need escaping
this-needs-quotes
and you specify the default migration table as follows
'default_migration_table' => 'this-needs-quotes.phinxlog',
The the create table portion of the migration process works without issue. However it then tries to run a select using the unescaped schema to see which migrations have run and fails preventing migration.
If you specify the schema as follows
'default_migration_table' => '"this-needs-quotes".phinxlog',
Then the create process double escapes
CREATE TABLE ""this-needs-quotes""."phinxlog"
And the SQL fails to execute.
If you do not include a default migration table then it appears that the schema selected is public and not the default search path schema.
There appears to be no way of creating migrations for a schema which requires escaping.
Hi, this is a relatively simple fix and I would love to open a PR, but it seems I do not have permission to do so.
There are two lines that need changing in src/Phinx/Db/Adapter/PostgresAdapter.php
$db->exec('SET search_path TO ' . $options['schema']);
$this->fetchAll(sprintf('SET search_path TO %s', $this->getGlobalSchemaName()));
If you escape the schema name then this resolves the problem and you can migrate when the schema contains characters which require escaping.
There's no way you don't have permission to open a PR. Anyone can do so.
PR seems open as https://github.com/cakephp/phinx/pull/1807
Did the PR resolve this?