-
Notifications
You must be signed in to change notification settings - Fork 65
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
Migrations can't be run on multiple schemas in the same database #92
Comments
slifty
changed the title
Migrations can't be run on multiple schemas
Migrations can't be run on multiple schemas in the same database
Jul 13, 2022
I see there is an open PR from two years ago that would solve this issue: #33 What are the odds of being able to merge that in sometime... Edit: I see the request on the PR! Working on that now. |
slifty
added a commit
to slifty/postgres-migrations
that referenced
this issue
Jul 13, 2022
* If a `migrations` table did exist in a schema outside of the search path, `doesTableExist` would return true but the migration would then fail with 'relation "migrations" does not exist' * See https://dba.stackexchange.com/a/86098 for the details on the query * This new query makes it possible to have one `migrations` table per schema Issue ThomWright#92 Migrations can't be run on multiple schemas in the same database Co-authored-by: Remi Koenig <r.koenig@agricool.co>
slifty
added a commit
to slifty/postgres-migrations
that referenced
this issue
Jul 13, 2022
* If a `migrations` table did exist in a schema outside of the search path, `doesTableExist` would return true but the migration would then fail with 'relation "migrations" does not exist' * See https://dba.stackexchange.com/a/86098 for the details on the query * This new query makes it possible to have one `migrations` table per schema Issue ThomWright#92 Migrations can't be run on multiple schemas in the same database Co-authored-by: Remi Koenig <r.koenig@agricool.co>
slifty
added a commit
to PhilanthropyDataCommons/service
that referenced
this issue
Jul 13, 2022
Integration tests are slower than unit tests because they rely on a database connection, so we want the ability to run them separately depending on our environment. Jest allows us to define different config files. By creating a `base` config we can define all of the common settings between unit and integration tests, and then customize for each type in the respective extended configs. In addition to configuration this begins to define define some hooks that make it possible to run tests in parallel. We can't actually use these hooks properly until an upstream bug is fixed in our migration package: ThomWright/postgres-migrations#92 Issue #43 Support integration tests
I've implemented this here, and released to npm. There are a few years of history on this feature in this repo, so I didn't try to make a PR for it here, but I'm happy to help get it in if desired. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using schemas to parallelize integration tests (one schema per test worker).
Before each test I want to run the following setup:
search_path
to be the schemaUnfortunately right now
postgres-migrations
only allows migrations to be once per database (NOT per schema). It looks like this is because inmigrate.ts
the check for the migrations table doesn't account for the idea that more than one schema can exist (and thatmigrations
existing in one doesn't meanmigrations
exists in the current search_path).As an example, if I manually create a
migrations
table in two different schemas this query would return more than one row:I hope this makes sense! It would be wonderful if this tool could support the parallel-test-schema use case.
The text was updated successfully, but these errors were encountered: