pop
pop copied to clipboard
migration_table_name is Appended to Postgres Connection String
Description
The migration_table_name option is added to Postgres connection strings, resulting in SQLSTATE 42704:
$ soda create --debug --env dml --path migrations-dml
v5.2.4
[POP] 2020/09/02 14:27:58 debug - Loading config file from /database.yml
[POP] 2020/09/02 14:27:58 info - create pricing (postgres://testing:testing@localhost:5432/primary?migration_table_name=dml_migration)
[POP] 2020/09/02 14:27:58 sql - CREATE DATABASE "pricing"
Error: couldn't create database pricing: error creating PostgreSQL database pricing: failed to connect to `host=localhost user=testing database=postgres`: server error (FATAL: unrecognized configuration parameter "migration_table_name" (SQLSTATE 42704))
Database, user, password, and etc. are masked/generic on purpose.
Steps to Reproduce the Problem
Given a database config file such as config/database.yml:
database:
dialect: "postgres"
database: {{ envOr "DB_NAME" "primary" }}
host: {{ envOr "DB_HOST" "localhost" }}
port: {{ envOr "DB_PORT" "5432" }}
user: {{ envOr "DB_USER" "testing" }}
password: {{ envOr "DB_PASSWORD" "testing" }}
# default migration_table_name is "schema_migration"
dml:
dialect: "postgres"
database: {{ envOr "DB_NAME" "primary" }}
host: {{ envOr "DB_HOST" "localhost" }}
port: {{ envOr "DB_PORT" "5432" }}
user: {{ envOr "DB_USER" "testing" }}
password: {{ envOr "DB_PASSWORD" "testing" }}
options:
migration_table_name: dml_migration
With those two migration folders existing on disk, run the command:
soda create --debug --env dml --path migrations-dml
And get the output above.
Expected Behavior
The option to work as described in documentation.
Actual Behavior
It did not work as described in documentation.
Info
Alpine 3.12, Go 1.14.6, soda built from source as v5.2.4.
I've run into this as well. Looks like that option would just need to be excluded from here: https://github.com/gobuffalo/pop/blob/master/connection_details.go#L180-L184 Or moved into its own struct field.
At the first place, having that option in that place is somewhat odd to me. will check it later.