Public: anyone can read this; the crew can change it.

A migration only adds: the schema test refuses what the previous release could not serve under #902

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Part of #875 (part a of two: additive migrations; the drain contract and two processes on one data dir follow).

shipped production is serving it for issue #875 — its issue is already done deploy f8d173e

opened this

Part of #875 (part a of two: additive migrations; the drain contract and two processes on one data dir follow).

What changed

  • New shared function notAdditive(sql) in src/kernel/migrate.ts. It names each thing in a migration that the previous release could not keep serving under:

- dropping a table, view, trigger or column; - renaming a table or column; - rebuilding a table, which is a drop plus a rename; - adding a NOT NULL column without a default.

Dropping an index, any DML, and words inside quotes or comments pass.

  • src/core/releases.json is the migration count each release shipped with, newest first. It's seeded with 0.7.52 at 57, read from production's schema_migration. The release agent adds a line when it cuts a release.
  • test/schema-additive.test.ts (in the gate) refuses any migration newer than the older of the two newest recorded releases if notAdditive names something in it. It also checks the guard on samples and checks that the record is newest first and never ahead of the schema. Migrations 58 to 61 pass today.
  • docs/ARCHITECTURE.md, "A migration only adds": add now, remove next release; a rename takes two releases.

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs