fix(db): complete migration baseline (136 tables) + schema-drift CI guard #4073
ccantynzcommented Jun 11, 2026
Originally written by @vercel[bot] on GitHub.
Deployment failed with the following error:
There is no GitHub account connected to this Vercel account.ccantynzcommented Jun 11, 2026
Originally written by @vercel[bot] on GitHub.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Actions | Updated (UTC) |
|---|---|---|---|
| alec-rae-com-admin | Preview, Comment | Jun 11, 2026 6:34am |
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
Originally written by @ccantynz-alt on GitHub.
Imported from https://github.com/ccantynz-alt/AlecRae.com/pull/58
Problem
A fresh
db:seedfailed (42703 column "storage_used_bytes" ... does not exist), and diffing the schema against the migrations surfaced the real issue: migrations covered only 16 of 136 schema tables. Adb:migrate-only fresh DB was missing 120 tables — including login-criticalpasskeys,refresh_tokens,connected_accounts.db:push(the obvious fallback) was also broken: drizzle-kit's esbuild loader can't resolve the explicit./x.jsschema imports.Per Craig's direction (Option 1): fresh DB assumed, no reconciliation — one clean baseline, schema as the single source of truth.
Fix
dist/schema/*.js; wiretsc &&intodb:push/db:generate/db:studio.0000_complete_baseline.sqlcovering all 136 tables. Prepended pgvectorCREATE EXTENSION(drizzle can't model extensions) and moved the HNSW + unique(email_id, model)embedding indexes into the schema so they're emitted and won't be dropped bypush.password123, so the seeded admin could never log in — replaced with a real argon2id hash.scripts/check-schema-drift.sh+db:check-drift+ a CISchema/Migration Driftjob that fails when the schema has changes not captured by a migration. Prevents the "17-of-137" trap from recurring.Verification (real Postgres 16, fresh DB,
vectorext created as superuser)db:migrate→ 136 tables ✅db:seed→ succeeds, prints tenant API key ✅/health200) ✅POST /v1/auth/login, email+password → RS256 JWT) ✅GET /v1/messageswith that token) → 200; rejects without token → 401 ✅bun run typecheckclean;db/apibuild clean (the only build/test failures in-sandbox are@alecrae/adminGoogle-Fonts fetch — a network limit, green in CI)Deploy notes
CREATE EXTENSION vectoras a Postgres superuser once beforedb:migrate(the non-superuseralecraerole can't create it;IF NOT EXISTSthen makes the in-migration call a no-op).WEBAUTHN_RP_ID+WEBAUTHN_ORIGINenv — the API throws on boot without them.Supersedes the incremental
0012fix from the first push (folded into the baseline).https://claude.ai/code/session_01McgJLnTbZG9mwhfwd5iAX3