feat(migrations): reconcile cards columns missed by initial-schema backfill (B1 of reconcile-historical-add-scripts) #148
No reviewers
Labels
No labels
agent-context-drift
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rstillwell/deckhearth#148
Loading…
Reference in a new issue
No description provided.
Delete branch "convoy/reconcile-b1-cards-columns"
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
Brief 1 (B1) of the
reconcile-historical-add-scriptsconvoy. Folds the effects ofscripts/add-card-columns.jsinto the migration history so a brand-new Neon branch onboarded bynpm install→npm run setup-dbends up structurally equivalent to prod on thecardstable.Adds exactly one new migration:
migrations/1781000000001_reconcile-cards-columns.js(82 lines including docstring +down()stub).Architect reference
.convoys/reconcile-historical-add-scripts.mdonconvoy/reconcile-historical-add-scripts(architect commit22ebef2)updated_atis already in initial-schema)pgm.sql(...)+IF NOT EXISTSguards matching1779853647564_initial-schema.js's style1781000000001(avoids parallel-implementerDate.now()collisions with B2-B6)cards.quantity+cards.favoritedare dead columns flagged indocs/SCHEMA_MAP.md§ "Known schema smells" #3; reproduce-then-deprecate via follow-upWhat changed
Two new columns added to
cardswith idempotency guards:quantityINTEGER0scripts/add-card-columns.jslines 22-25user_cards); folded for fresh-env parityfavoritedBOOLEANfalsescripts/add-card-columns.jslines 29-32user_favorites); folded for fresh-env parityBoth use
ALTER TABLE cards ADD COLUMN IF NOT EXISTS …, byte-equivalent in intent to the historical script.down()is a hard-stubthrow new Error(...)matching the shape of1779853647564_initial-schema.js::down()— these are reconciliation migrations; prod schema state is the source of truth and rolling back would create fresh-vs-prod inconsistency. Retirement of either column belongs to the queueddrop-dead-cards-columnsconvoy (see Finding 3 follow-up).Idempotency proof (D2)
Static grep against the migration tree confirms neither column exists in any prior migration:
Those three hits are on
user_cards,collection_cards, anddeck_cardsrespectively (lines 72-83, 99-107, 122-131 — each is inside a differentCREATE TABLEblock). TheCREATE TABLE cardsblock in initial-schema spans lines 45-69 and contains neither column.This means the new migration is safe to run against:
scripts/add-card-columns.jsran pre-migration-tool → columns already exist → ALTER is a no-op (onlypgmigrationsrow recorded).Verification
node --check migrations/1781000000001_reconcile-cards-columns.jsnpm run lintmain(components/CollectionsPageView.js's unused eslint-disable; unrelated to this change)npm run test:runnpm run migrate upend-to-end against a throwaway Neon branch.convoys/reconcile-historical-add-scripts.md§ Verification plan; B7 promotes it todocs/operations/RECONCILE-VERIFICATION.md)Notes on PR #32's NEW post-architect migrations on
cardsThe architect plan (commit
22ebef2) was drafted before PR #32 landed1781440700404_add-scryfall-bulk-columns.js, which adds 13 Scryfall bulk-data columns tocards(oracle_id,illustration_id,color_identity,keywords,legalities,flavor_text,artist,released_at,layout,edhrec_rank,reserved,reprint,finishes).Per the brief's "Read FIRST" step 5: verified by reading the migration in full + grepping for
quantity/favorited. No overlap with B1's scope. No scope reduction required; B1 ships as-planned with both columns.1781440721350_add-tagger-tables.js(also new since architect) is on Tagger join tables — not oncardsdirectly. No overlap.Test plan
node --checkcleannpm run lint— no new problems (pre-existing warning unchanged)npm run test:run— 131/131 passquantitynorfavoritedis in any priorcards-touching migrationnpm run setup-db, run D5 verification plan to confirm structural parity with prod'scardstableReferences
.convoys/reconcile-historical-add-scripts.md(commit22ebef2)scripts/add-card-columns.jsdocs/SCHEMA_MAP.md§ "Known schema smells" #3Made with Cursor
The latest updates on your projects. Learn more about Vercel for GitHub.
Pipeline Health
Build + CI gates
Build runs on Vercel; this CI runs lint and schema-map drift only (no duplicate build).
Role reports
See individual comments above for details. This rollup updates automatically.