Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change correctly reorders identity-drop statements to satisfy PostgreSQL ALTER constraints and is backed by focused unit tests and fixtures covering the reported and related failure modes.
Pull request overview
Fixes Issue #243 by making TableColumn::get_alter_script emit DROP IDENTITY before any per-column ALTERs that relax identity constraints (type/default/nullability), preventing PostgreSQL from rejecting the migration when identity is removed alongside other changes.
Changes:
- Emit
ALTER ... DROP IDENTITY IF EXISTSat the start of a column’s ALTER list; keep identity add/update logic after type/default/nullability handling. - Add targeted unit tests to assert correct intra-column statement ordering for identity drop/add scenarios.
- Add schema fixtures + README/CHANGELOG documentation covering the regression and its verification.
File summaries
| File | Description |
|---|---|
| app/src/dump/table_column.rs | Reorders identity-drop emission ahead of type/default/nullability ALTERs to satisfy PostgreSQL constraints. |
| app/src/dump/tests/table_column.rs | Adds unit tests asserting identity drop precedes DROP NOT NULL, SET DEFAULT, and type changes; and identity add ordering remains correct. |
| data/test/schema_a.sql | Adds FROM-side fixture table with identity columns that will relax identity guarantees in TO. |
| data/test/schema_b.sql | Adds TO-side fixture table where identity is removed and one constraint is relaxed per column. |
| data/test/README.md | Documents the new Issue #243 fixture and why ordering must be identity-first on drop. |
| CHANGELOG | Notes Issue #243 fix and explains the underlying ordering constraint. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
nettrash
deleted the
243-column-diff-drops-not-null-before-dropping-identity-failing-on-columns-whose-target-state-removes-both
branch
September 6, 2026 08:23
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.
closes #243