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_table_name is Appended to Postgres Connection String #587

Open
emmercm opened this issue Sep 2, 2020 · 2 comments
Open

migration_table_name is Appended to Postgres Connection String #587

emmercm opened this issue Sep 2, 2020 · 2 comments
Labels
bug Something isn't working s: triage Some tests need to be run to confirm the issue
Milestone

Comments

@emmercm
Copy link

emmercm commented Sep 2, 2020

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.

@stanislas-m stanislas-m added the bug Something isn't working label Oct 20, 2020
@kyrozetera
Copy link
Contributor

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.

@sio4
Copy link
Member

sio4 commented Sep 20, 2022

At the first place, having that option in that place is somewhat odd to me. will check it later.

@sio4 sio4 added this to the Backlog milestone Sep 20, 2022
@sio4 sio4 added the s: triage Some tests need to be run to confirm the issue label Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working s: triage Some tests need to be run to confirm the issue
Projects
None yet
Development

No branches or pull requests

4 participants