Skip to content

Drop the definition.name narrowing from the artifact migration - #1500

Merged
RhysSullivan merged 1 commit into
mainfrom
fix/definition-name-varchar-drift
Jul 29, 2026
Merged

Drop the definition.name narrowing from the artifact migration#1500
RhysSullivan merged 1 commit into
mainfrom
fix/definition-name-varchar-drift

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

Main's Deploy has been red since #1472: migration 0013 includes ALTER TABLE "definition" ALTER COLUMN "name" SET DATA TYPE varchar(255), and production has definition names longer than 255 chars, so the migration fails with 22001 and rolls back — 0013–0015 never applied, the artifact table doesn't exist in prod, and Deploy cloud is skipped on every push (prod is still running pre-#1472 code).

The ALTER is schema drift resurfacing, not an intentional change. definition.name was widened to text in June ("Allow long definition names in cloud schema", dd7aaf6) because $def names exceed 255, but only the baseline SQL/snapshot was patched — the fumadb source (core-schema.ts) kept keyColumn → varchar(255). #1251 hit the same drift and hand-dropped the ALTER from its migration; #1472's drizzle-kit generate diffed snapshot (text) against schema (varchar(255)) and faithfully re-emitted the narrowing.

This ends the drift at the source:

  • core-schema.ts: definition.name is now textColumn, with a comment explaining why it must never go back to keyColumn. executor-schema.ts regenerated via db:schema (only that one line changes).
  • 0013: the narrowing ALTER removed. Editing it in place is safe — it was never stamped anywhere durable (prod rolled back atomically; the release containing it is unpublished; dev/e2e DBs are ephemeral).
  • 0013–0015 snapshots: definition.name corrected to text so future generates diff against reality. drizzle-kit generate now reports no changes.

Invariants and failure states considered:

  • Prod (column already text, rows > 255 chars, journal at 0012): fixed 0013–0015 apply cleanly; verified against PGlite seeded with a 400-char name — migrates, artifact created, name stays text.
  • Fresh database (0000→0015): verified clean; baseline creates name text, nothing alters it after.
  • No data-shape change for readers: the live column type is unchanged everywhere; this only stops a failing narrowing from being applied.
  • Portability: the varchar(255) convention exists for MySQL index-prefix limits, but no host ships MySQL (cloud is Postgres, local/desktop are SQLite where varchar is text anyway), and the live tables have indexed text since June — the source now records that reality.

Once merged, the Migrate job should stamp 0013–0015 and unblock Deploy cloud (which also needs Cloudflare's "Errors Deploying Workers Scripts" incident resolved).

@RhysSullivan
RhysSullivan marked this pull request as ready for review July 29, 2026 21:25
@RhysSullivan
RhysSullivan merged commit 5eb2ca3 into main Jul 29, 2026
17 of 19 checks passed
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

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.

1 participant