Auto-migrate: Allow adding new variants at the tail#2874
Merged
Conversation
mamcx
reviewed
Jun 17, 2025
c43dff2 to
afac310
Compare
gefjon
requested changes
Jun 26, 2025
Contributor
gefjon
left a comment
There was a problem hiding this comment.
Minor comment-ey nits, and a significant logic concern: I think that renaming enum variants or field names should require a manual migration. There's no technical reason why we have to do this, but I think that using ordering as a source of truth is a surprising and footgun-ey behavior.
joshua-spacetime
pushed a commit
that referenced
this pull request
Jul 1, 2025
2 tasks
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
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.
Description of Changes
To the auto-migrate machinery, detection of the case where a sum type is extended with additional variants and where the sum type as a whole does not grow in size. This then results in a new datastore call
alter_table_row_typewhich independently checks for "soundness" of using the new row type for the existing rows. This call, being a schema altering one, is handled, in terms of transactionality, the same way that e.g.,create_indexis, by adding a pending schema change.API and ABI breaking changes
None
Expected complexity level and risk
3 - this is fairly sensitive logic that is critical to get right so that we don't cause UB and problems down the line.
Testing
alter_table_accesswas untested and is now tested also in terms of transactionality.