deckhearth/.convoys/pricing-online-local/brief-1-pricing-schema-migration.md
Randall Stillwell d0468015eb
Some checks failed
CI / Lint (pull_request) Has been cancelled
CI / Schema map up to date (pull_request) Has been cancelled
CI / Forbidden patterns (9 checks) (pull_request) Has been cancelled
CI / Migrations apply (node-pg-migrate) (pull_request) Has been cancelled
Visual diff / Should run? (pull_request) Has been cancelled
CI / Unit tests (vitest) (pull_request) Has been cancelled
Convoy metrics gate / Require role-event telemetry on convoy PRs (pull_request) Has been cancelled
PR Health rollup / Aggregate gate status (pull_request) Has been cancelled
Preview smoke / Should run? (pull_request) Has been cancelled
Preview smoke / Playwright smoke (pull_request) Has been cancelled
Visual diff / Screenshot diff (pull_request) Has been cancelled
feat(pricing): convoy for online prices and local stores
Add pricing schema, free API integrations (MTG bulk, TCGdex, Foolio),
valuation and sort-by-price, card detail pricing UI, and nearby store
discovery via home zip and OSM geo clients.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:47:46 -05:00

39 lines
1.6 KiB
Markdown

---
convoy: pricing-online-local
brief_number: 1
depends_on: []
recommended_model: composer-2.5
model_tier: standard
files:
- migrations/1783000000001_add-pricing-schema.js
- docs/SCHEMA_MAP.md
---
# Brief 1: Pricing schema migration
## Goal (1 sentence)
Ship the node-pg-migrate migration for pricing timestamps, price history, user home zip, and geo caches.
## Files in scope (do not edit anything else)
- `migrations/1783000000001_add-pricing-schema.js`
- `docs/SCHEMA_MAP.md`
## Conventions to follow
- Generate via `npm run migrate create add-pricing-schema -- -j js`; apply with `npm run migrate up`.
- `down()` must hard-stub (throw) — see `migrations/1779853647564_initial-schema.js`.
- Update `docs/SCHEMA_MAP.md` for every new column/table (AGENTS.md § Schema changes).
- Use `ADD COLUMN IF NOT EXISTS` / `CREATE TABLE IF NOT EXISTS` for idempotency.
## Acceptance criteria
- [ ] Migration adds `cards.prices_updated_at TIMESTAMPTZ`
- [ ] Migration creates `card_price_history` with UNIQUE `(card_id, source, price_type, currency, recorded_at)` and index on `(card_id, recorded_at DESC)`
- [ ] Migration adds `users.home_zip VARCHAR(10)`
- [ ] Migration creates `geo_zip_cache` and `geo_stores_cache` tables per Architecture §3
- [ ] `docs/SCHEMA_MAP.md` updated
- [ ] `npm run migrate up` succeeds on fresh + existing DB
- [ ] No scope expansion (do not edit files outside `files:` above)
## Rationale (≤3 sentences)
All pricing and geo features depend on these columns/tables. Landing schema first unblocks parallel implementers for bulk ingest, APIs, and settings without merge conflicts on migration files.