fix(db): register extra_large via migration 0038 (GRO-1999) #130
Reference in New Issue
Block a user
Delete Branch "flea/gro-1999-migration-0038"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
GRO-1979 added 0037_add_extra_large_to_pet_size_category with a journal
whenof 1751500000000 — below the 0033 high-water mark (1779500000000) on existing UAT/persistent DBs. Drizzle only applies a migration when itsjournal.whenis strictly greater thanmax(applied created_at), so 0037 was silently skipped on the existing UAT DB, leavingpet_size_categorywithoutextra_largeand crashlooping the UATseed-test-datajob with22P02 invalid input value for enum pet_size_category: "extra_large".This adds migration 0038 with a monotonic
when: 1780000000000so it applies on both existing UAT/persistent DBs and fresh DBs. The statement is idempotent (ADD VALUE IF NOT EXISTS) and a single auto-commit DDL (ADD VALUE cannot run inside a transaction block — same as 0037).Changes
packages/db/migrations/0038_register_extra_large_pet_size_category.sql(new)packages/db/migrations/meta/_journal.json— appendidx: 38,when: 1780000000000,tag: 0038_register_extra_large_pet_size_categoryScope guardrails honored
seed.ts(it already usesextra_largeper the drizzlePetSizeCategorytype).Verification
_journal.jsonvalidates as JSON (38 entries;when=1780000000000is strictly > current max1779500000000).ADD VALUEcannot run in a txn block).pet_size_categoryenum should includeextra_large. To verify post-deploy:SELECT enumlabel FROM pg_enum WHERE enumtypid = 'pet_size_category'::regtype ORDER BY enumsortorder;should show {small, medium, large, xlarge, extra_large}.cc @cpfarhood
🤖 Generated with Claude Code
Co-Authored-By: Paperclip noreply@paperclip.ing
LGTM. Reviewed: migration 0038 SQL (single standalone ADD VALUE IF NOT EXISTS, no txn block, idempotent), journal entry (idx=38, when=1780000000000 > HWM 1779500000000, correct tag/version/breakpoints, 38 entries total), scope guardrails (2 files only, no seed.ts, no prior-migration edits). CI all green (Lint & Typecheck, Test, Build & Push Docker). No conflicts. Approved — passing to CTO for merge.
CTO Review: APPROVED ✅
Reviewed for correctness, architecture, and security per SDLC Phase 1.
ALTER TYPE "pet_size_category" ADD VALUE IF NOT EXISTS 'extra_large'; standalone statement (correct —ADD VALUEcannot run in a txn block), idempotent.idx:38,when:1780000000000is strictly > the persistent-DB high-water-mark1779500000000, so drizzle will apply it on the existing UAT/persistent DB and fresh DBs. This is the right fix — re-register rather than rewrite 0037 history.extra_largeto match the drizzlePetSizeCategorytype and seed.ts;seed.tscorrectly untouched.success).mergeable: true.QA approval (Lint Roller) + CTO approval satisfied. Merging to
dev.cc @cpfarhood