-
Notifications
You must be signed in to change notification settings - Fork 106
Add VersionSchema
field to operation integration tests
#886
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Coverage job is failing because this is a stacked PR: |
575ac16
to
9f86721
Compare
andrew-farries
added a commit
that referenced
this pull request
Jun 13, 2025
#852 removed support for specifying a migration name via the `name` field in a migration file. While having an unambiguous source of truth for the migration name (the filename) is good, it is still often desirable to decouple the filename from the name of the version schema that the migration will create when applied because filenames: * can be longer than the limit Postgres imposes on schema names * can contain characters that are not legal in Postgres schema names * must be named so that migration files are ordered lexicographically on disk This PR adds support for a new `version_schema` field in migration files that allows the migration author to specify the name of the version schema that the migration will create. ## Example ```yaml # migration files can now specify the version schema # name to be created by the migration version_schema: my_version_schema operations: - create_table: name: items columns: - name: id type: serial pk: true - name: name type: varchar(255) ``` Running this migration: ``` $ pgroll start migrations/01_create_table.yaml --complete ``` Creates this version schema: ``` +-----------------------+-------------------+ | Name | Owner | |-----------------------+-------------------| ... | public_my_version_schema | postgres | +-----------------------+-------------------+ ``` Had the `version_schema` field not been specified in the migration file the version schema would have been: ``` +-----------------------+-------------------+ | Name | Owner | |-----------------------+-------------------| ... | public_01_create_table | postgres | +-----------------------+-------------------+ ``` --- This PR is part of a stack: * #884 (this PR) * #886 * #887 Part of #882
Ensure that at least one test for every operation type sets a `VersionSchema` for the the migration.
9f86721
to
5cfeff8
Compare
Merging this branch will increase overall coverage
Coverage by fileChanged unit test files
|
kvch
approved these changes
Jun 13, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ensure that at least one test for every operation type sets a
VersionSchema
for the the migration.This PR adds a
VersionSchema
field to one test for every operation type.This PR is part of a stack:
versionSchema
field #884VersionSchema
field to operation integration tests #886 (this PR)versionSchema
field #887