8000 Fix previous_version: Take inferred migrations into account by agedemenli · Pull Request #631 · xataio/pgroll · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix previous_version: Take inferred migrations into account #631

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 4 commits into from
Jan 29, 2025

Conversation

agedemenli
Copy link
Contributor
@agedemenli agedemenli commented Jan 28, 2025

Add includeInferred parameter to function previous_version.
If it's false, it will behave exactly as it did before this PR. It will be called with false in Complete, to ignore inferred migrations when dropping the version schema, because inferred migrations do not have version schemas.
If it's true, inferred migrations will be taken into account when finding the previous version. It will be called with true when finding the previous version for Rollback.

When inferred migrations were not taken into account, Rollback was causing a segmentation violation because of nil pointer for new columns/tables added by SQL.

This PR also modifies the test TestNoVersionSchemaForRawSQLMigrationsOptionIsRespected so that we will be testing PreviousVersion with both options.

Fixes: #623

@agedemenli agedemenli marked this pull request as ready for review January 28, 2025 15:58
@agedemenli agedemenli requested review from andrew-farries, exekias and kvch and removed request for andrew-farries January 28, 2025 15:58
@agedemenli agedemenli merged commit 747f9d4 into main Jan 29, 2025
28 checks passed
@agedemenli agedemenli deleted the fix-previous_version branch January 29, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation violation when adding unique constraint
3 participants
0