Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

Postgres: version table existence check in current schema #146

Merged
merged 1 commit into from Feb 4, 2017
Merged

Postgres: version table existence check in current schema #146

merged 1 commit into from Feb 4, 2017

Conversation

FreGalle
Copy link
Contributor

@FreGalle FreGalle commented Feb 3, 2017

When running migrations in parallel on the same database but in different schemas, ensureVersionTableExists was schema-agnostic. This meant that having one schema_migrations, no matter in which schema, -could even be outside the search_path- would prevent the creation of more schema_migrations tables in different schemas.

I'm not sure whether the check should only look at the current schema or the whole search_path. For our use-case (testing packages in parallel using separate schemas) the former was sufficient, so I thought I'd open a PR for it.

@mattes
Copy link
Owner

mattes commented Feb 3, 2017

Thanks for opening a PR.

You should be able to specify the schema with ?currentSchema=public as of Postgres 9.4. Does that work for you?

https://jdbc.postgresql.org/documentation/94/connect.html#connection-parameters

@FreGalle
Copy link
Contributor Author

FreGalle commented Feb 4, 2017

That seems to be a jdbc-specific connection parameter. I am already specifying ?search_path=name which does work as intended except for the version table existence check which does not take into account current schema or search path.

@mattes
Copy link
Owner

mattes commented Feb 4, 2017

I see now. Merging the PR. thanks.

That seems to be a jdbc-specific connection parameter.

I was under the assumption, that those can be used to...
https://github.com/lib/pq/blob/master/doc.go#L78-L80

@mattes mattes merged commit bbb58ac into mattes:master Feb 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants