-
Notifications
You must be signed in to change notification settings - Fork 105
Update docs for new versionSchema
field
#887
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
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
This was referenced Jun 12, 2025
Coverage job is failing because this is a stacked PR: |
575ac16
to
9f86721
Compare
d398139
to
2b1efb0
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
9f86721
to
5cfeff8
Compare
2b1efb0
to
6e1b432
Compare
kvch
approved these changes
Jun 13, 2025
Add the `versionSchema` field
Add an example migration that uses the `versionSchema` field in the migration file.
6e1b432
to
43219ee
Compare
Merging this branch will not change overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
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.
Update documentation for the new
versionSchema
field and add an example migration.This PR is part of a stack:
versionSchema
field #884VersionSchema
field to operation integration tests #886versionSchema
field #887 (this PR)