Skip to content

fix(schema): a NOT NULL column with a declared default is additive (#904) - #905

Merged
athvin merged 2 commits into
mainfrom
fix/904-not-null-default
Nov 8, 2026
Merged

athvin merged 2 commits into
mainfrom
fix/904-not-null-default

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #904

What

Treat a missing Postgres NOT NULL column with a declared default as additive, and include NOT NULL plus DEFAULT in the generated ADD COLUMN statement. Columns without defaults remain breaking changes.

Why

The schema pre-upgrade hook rejected the tags.kind column introduced by #875 before the repair fixup could run, blocking deployment. This change aligns classification and emitted SQL with the documented additive rule.

Proof

Rust CI run 42520403802 passed on merge 85de695; images run 42520403886 and deploy run 42520861582 passed. The merge remains an ancestor of origin/main.

Risk & rollback

Scoped to missing Postgres columns with declared defaults. Reverting restores the prior refusal and could block deployments requiring such a column.

Post-merge ledger

Closed by: Codex · session 01a1be1b-0c92-7703-a4c2-25cb2c999baa on Mac.lan · 2026-11-09T02:39:32.358258+00:00

Context — recovered evidence

This PR's body was empty when recovering Codex session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc. This record was reconstructed from issue #904, the merge and workflow records, issue #914, ancestry, board automation, and observed descendant process logs. The recovered session recorded an aged-store reproduction; this recovery did not rerun that local test or alter the code.

)

The deploy gate (er-server migrate --expect-additive) plans live-vs-catalog
before any fixup runs, and the differ classified EVERY missing NOT NULL
column as breaking — so #805's tags.kind (NOT NULL DEFAULT 'user') refused
the schema-migrate hook and the release rolled back. The design table in
entity-framework-design.md always said 'refused WITHOUT a default'; the
code now matches: with a default declared, the add is Safe on Postgres,
and add_column_sql emits both clauses (NOT NULL DEFAULT) so the old
release's column-named INSERTs keep working underneath the deploy.
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.

migrate --expect-additive refuses a NOT NULL column that carries a default — #805's tags.kind can never deploy

2 participants