Repository navigation
feat: rename enum values in place, name the types the models do not create, and check view models in drift - #350
Merged
Merged
Conversation
borderss
force-pushed
the
feat/189-193-232
branch
2 times, most recently
from
November 28, 2026 00:07
c7a99d1 to
c551602
Compare
borderss
force-pushed
the
feat/189-193-232
branch
from
November 28, 2026 00:10
c551602 to
353b0b7
Compare
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.
What and why
Renaming an enum value showed up as a new value plus a removed one, with a warning to rebuild the type (#189).
diff --rename status.banned=blockednow writes oneALTER TYPE ... RENAME VALUE, rows keep their data, and the dry run hints at it the way it does for a column rename.driftpassed on a database adopted from a dump, while a migration made from the models alone failed on an empty database at the first column of a domain, composite or extension type (#193). After its verdict,driftnow lists the types the models use and do not create, with the columns that use each. It is a note, so the exit code is unchanged.driftnever looked at view models, so a field renamed on ab.Viewmodel passeddriftand failed at the first query (#232).driftnow reports a view the models read that the database lacks, and each column a model reads that its view lacks, and fails on them. Views stay out of the snapshot.db-showlists materialized views after the tables. The third gap in #232, a key on an existing unique constraint, needs a builder API decision, so this PR leaves #232 open.Decisions 172, 173 and 174 record the choices.
docs/api.txtchanged on purpose:RenameEnumValue,Hint.EnumandHint.Value,ExternalTypes,RelationColumns,View,Schema.ViewsandSummary.MaterializedViews.Closes #189
Closes #193
Part of #232
Checklist
feat:,fix:,docs:...), since it becomes the squashed commitmain(git pull --rebase origin main), with no merge commitsmake fmt,make lintandmake testpassmake test-pgpasses, if the change reaches the database (and the other dialects' targets, if it touches them)docs/api.txtis updated withgo test ./tests/api -update, if the exported API changed on purposeDocs after release:
docs/migrations/commands.mdx(--renameon an enum value,drifton views and the types note,db-showwith materialized views),docs/migrations/generated-sql.mdxanddocs/migrations/troubleshooting.mdx(enum value renames),docs/migrations/adopting.mdx(the types note; "From the models" leaves out domains and the like),docs/models/shared-tables-and-views.mdx(drift checks a view's columns).