File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,6 +123,21 @@ preserves the PK through `RENAME COLUMN`) is not mistaken for a move. The read-o
123123primary-key drift rather than throwing. Auto-migrating the move (adding the
124124` add-primary-key ` / ` drop-primary-key ` change kinds) is a documented future follow-up.
125125
126+ #### A legacy ` serial ` primary key (adoption-time refusal)
127+
128+ When migrating against a live Postgres database whose primary key is a legacy
129+ ` serial ` / ` bigserial ` column — one carrying a live ` nextval(...) ` default — and the
130+ metadata declares that ` identity.primary ` ** without** ` @generation ` , the diff would
131+ otherwise emit ` ALTER COLUMN … DROP DEFAULT ` . That is destructive: every insert that
132+ omits the id starts failing. The missing ` @generation ` is genuinely ambiguous — it reads
133+ identically whether the author simply never declared it (and wants to keep
134+ auto-increment) or deliberately dropped it (to move the column onto app-assigned ids) —
135+ so ` meta migrate ` ** refuses rather than guessing** , the same detect-and-refuse arc as the
136+ primary-key move above. Declare ` @generation: increment ` on the identity to keep the
137+ sequence, or pass ` --allow drop-identity-default ` if removing auto-increment is
138+ intentional. An identity that * does* declare ` @generation: increment ` never reaches this
139+ gate (its default diff is skipped), so only the undeclared case fires.
140+
126141### Java
127142
128143Schema migrations for Java projects are owned by the ** TypeScript toolchain**
You can’t perform that action at this time.
0 commit comments