Skip to content

chore(db): accurate schema.sql + schema redesign proposal#7

Open
StockerMC wants to merge 1 commit into
mainfrom
chore/db-schema-cleanup
Open

chore(db): accurate schema.sql + schema redesign proposal#7
StockerMC wants to merge 1 commit into
mainfrom
chore/db-schema-cleanup

Conversation

@StockerMC
Copy link
Copy Markdown
Owner

Summary

Two docs, no schema executed.

1. Regenerated backend/data/schema.sql

The committed schema was stale (predated most tables/columns, had a FIXME: actually update our DB note). Regenerated from the live database with every table/column/index/FK/function, each table annotated by real-world status: ACTIVE / LEGACY / DEAD / WORKER.

2. New docs/schema-redesign.md

Evaluates how the DB is used today and proposes a cleaner target:

  • Three generations of the matching pipeline coexist; only v3 (company_productsproduct_creator_matchescreator_videos) is alive.
  • A merchant is split across companies + shopify_shops + shopify_oauth_tokens (access_token stored twice).
  • A creator isn't an entity — identity smeared across 4 tables as loose columns.
  • Dead (product_pages, matches) and worker (yt_shorts_all/pending) tables sit in public.

Proposes 18 → 11 tables with a 4-phase migration plan. Phase 1 (drop confirmed-dead product_pages + matches) is the only safe-now step and is held for explicit approval.

No DROP/ALTER is run by this PR — it's documentation + an accurate snapshot.

The committed schema.sql was stale (predated most tables/columns, had a
'FIXME: actually update our DB' note). Regenerate it from the live database
with every table/column/index/FK/function, annotated by real-world status
(ACTIVE / LEGACY / DEAD / WORKER).

Add docs/schema-redesign.md: evaluates how the DB is used today (three
generations of the matching pipeline, merchant/creator identity split across
multiple tables, dead + worker tables in public) and proposes a cleaner
18->11 table target with a phased migration plan.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
maatchaa Ready Ready Preview, Comment May 31, 2026 3:19pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant