feat(migrations): reconcile collections columns missed by initial-schema backfill (B2) #150
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#150
Loading…
Reference in a new issue
No description provided.
Delete branch "convoy/reconcile-b2-collections-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 2 of the
reconcile-historical-add-scriptsconvoy. Captures thecollections-table DDL that historical scripts added to prod butmigrations/1779853647564_initial-schema.jsnever captured.collections.visibility VARCHAR(20) DEFAULT 'private'scripts/add-collaboration-features.js(collections half)collections.tcg VARCHAR(50) DEFAULT 'MTG'scripts/add-collaboration-features.js(collections half)collections.tags TEXTscripts/add-collaboration-features.js(collections half)collections.slug VARCHAR(100) UNIQUEscripts/add-collection-slugs.jsidx_collections_slugUNIQUE INDEXscripts/add-collection-slugs.jscheck_slug_formatCHECK constraintscripts/add-collection-slugs.jscollections.image TEXTscripts/add-image-column.jsOut of scope
collection_permissions,collection_activity,users.is_pending,idx_collections_visibility,idx_collection_permissions_*,idx_collection_activity_collection_id— owned by B3(
reconcile-collaboration-tables) per architect plan.is_system_collection— already captured bymigrations/1780378340194_system-collection-description.js.plan (
Defer slug backfill DML — generating slugs on a fresh env is moot.). Long-lived envs already ran the backfill historically.Idempotency (D2)
Every statement is
IF NOT EXISTS-guarded:ADD COLUMN IF NOT EXISTSfor the 5 columns. The inlineUNIQUEclauseon
slugis silently ignored when the column already exists, so prod(already has the autogen
collections_slug_key) and fresh envs bothconverge.
CREATE UNIQUE INDEX IF NOT EXISTSforidx_collections_slug.DO $$ ... END $$block guarded bypg_constraint-existence checkfor
check_slug_format(Postgres has no nativeIF NOT EXISTSclausefor named constraints).
Static idempotency grep confirms each B2 column/constraint is the sole
owner across all 8 migrations. The
image_url/stock_image_urlreferences in
1779853647564_initial-schema.jsare on thecardstable, not
collections. Thetagstable created in1781440721350_add-tagger-tables.jsis a separate table from thismigration's
collections.tagscolumn.Down-migration
Hard stub. Throws with a descriptive error matching the initial-schema
style. Rolling back would erase visibility / tcg / tags / slug / image
data on every collections row.
Files changed
migrations/1781000000002_reconcile-collections-columns.js(new, 114 lines)Acceptance criteria
1781000000002honoredvisibility,tcg,tags,slug,idx_collections_slug,check_slug_format,image)reserved for B3,
is_system_collectionleft to existing migration)down()hard-stub throw matching initial-schema stylescripts/add-*/fix-*/seed-*files(no-go-zones rule)
lib/slug-utils.js(runtime context only)Test plan
node --check migrations/1781000000002_reconcile-collections-columns.js→ exit 0npm run lint→ 0 errors (1 pre-existing unrelated warning incomponents/CollectionsPageView.js)npm run test:run→ 131/131 passingsole owner across
migrations/*.jsplan); to verify, the operator runs
npm run migrate upagainst afresh Neon branch and a long-lived env (both should succeed; both
should be no-ops on
pgmigrations-row insert plus the DDL-idempotent statements).
Notes for reviewer
slug VARCHAR(100) UNIQUEinline clause and the explicitidx_collections_slugindex both exist in the historical script; bothare replicated here to match prod state byte-equivalently. Postgres
ends up with the autogen
collections_slug_keyunique constraint(from the inline clause) AND the named
idx_collections_sluguniqueindex — same as prod. This double-uniqueness is benign at the SQL
level.
idx_collections_visibilityeven thoughthe
visibilitycolumn lands here — that index is in thecollaboration-half indexes that B3 owns.
parallel against disjoint migration files and disjoint pre-assigned
timestamps. No file-level conflicts expected.
Made 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.