Skip to content

#243 column diff drops not null before dropping identity failing on columns whose target state removes both - #248

Merged
nettrash merged 1 commit into
v1.0.27from
243-column-diff-drops-not-null-before-dropping-identity-failing-on-columns-whose-target-state-removes-both
Sep 6, 2026
Merged

nettrash merged 1 commit into
v1.0.27from
243-column-diff-drops-not-null-before-dropping-identity-failing-on-columns-whose-target-state-removes-both

Conversation

@nettrash

@nettrash nettrash commented Sep 6, 2026

Copy link
Copy Markdown
Owner

closes #243

@nettrash nettrash added this to the v1.0.27 milestone Sep 6, 2026
@nettrash nettrash self-assigned this Sep 6, 2026
Copilot AI lite review requested due to automatic review settings September 6, 2026 07:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 EXISTS at 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
nettrash merged commit edc3840 into v1.0.27 Sep 6, 2026
17 checks passed
@nettrash
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
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.

2 participants