Migrate cannot run with postgres schema that needs to be escaped
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the migration with a PostgreSQL schema requiring escaping and a default_migration_table, then compare the SQL used to create the table with the SQL used to select migration records. Done means both operations handle the schema correctly without double escaping, and migrations without an explicit table use the intended default schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100