deckhearth/migrations
Randall Stillwell 89ca3638b5 feat(migrations): reconcile favorites system missed by initial-schema backfill (B4)
Captures the DDL effects of scripts/add-favorites-system.js (a historical
no-go-zone script) so a fresh Neon branch onboarded via npm run setup-db
has the same user_favorites table + 4 indexes that prod has via the
historical script. Brings fresh envs to parity with prod for the
favorites surface used by pages/api/favorites.js.

Shape matches the historical script and the runtime API verbatim:
  - user_favorites(id, user_id FK CASCADE, item_type VARCHAR(50),
    item_id INTEGER, created_at, UNIQUE(user_id, item_type, item_id))
  - idx_user_favorites_user_id / _item_type / _item_id / _user_type

CREATE TABLE / CREATE INDEX guarded with IF NOT EXISTS per convoy
decision D2 — re-running against any env where the historical script
already ran is a documented no-op (only the pgmigrations row is new).

down() is a hard stub: rolling back would drop user_favorites and every
row in it; removal deserves its own scoped convoy.

Part of .convoys/reconcile-historical-add-scripts (commit 22ebef2),
Brief 4 of 7. Base PR is main, not the parent convoy branch, per the
parallel-implementer dispatch pattern.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 08:04:24 -05:00
..
1779853647564_initial-schema.js feat(infra): adopt node-pg-migrate + backfill initial schema migration (#32) 2026-05-26 23:01:58 -05:00
1779853647565_add-pg-trgm-card-name-index.js feat(scanner): AI Gateway vision + Layer-1 Tesseract/pg_trgm OCR (#38) 2026-05-27 12:59:59 -05:00
1779853647566_add-scan-tables.js ci: run migrations against Postgres service container in CI (#64) 2026-06-02 11:01:18 -05:00
1779908094455_add-user-cards-scan-image-url.js feat(scanner): persist scan captures to Blob (Brief 3) (#44) 2026-05-27 13:57:26 -05:00
1780378340194_system-collection-description.js ci: run migrations against Postgres service container in CI (#64) 2026-06-02 11:01:18 -05:00
1781000000004_reconcile-favorites-system.js feat(migrations): reconcile favorites system missed by initial-schema backfill (B4) 2026-06-14 08:04:24 -05:00
1781440700404_add-scryfall-bulk-columns.js feat(catalog): Scryfall bulk data import + Tagger community tags 2026-06-14 07:51:39 -05:00
1781440721350_add-tagger-tables.js feat(catalog): Scryfall bulk data import + Tagger community tags 2026-06-14 07:51:39 -05:00