2. Generate Database Types
Purpose: Regenerate TypeScript types from the live Supabase schema after any migration that adds, removes, or modifies table columns.
Prerequisites:
SUPABASE_PROJECT_IDset in.env.local(or pass--project-idflag)SUPABASE_ACCESS_TOKENfor remote generation
Cost / Duration: $0 | 1-2 min
Prompt
Regenerate TypeScript types from the Supabase schema.
Step 1 — Generate types:
```bash
bun run db:types
```
Pulls the current schema from Supabase and writes TypeScript types to
the DB package.
Step 2 — Review the generated changes:
```bash
git diff packages/db/
```
Verify new tables appear and modified columns are reflected.
Step 3 — Verify types are current:
```bash
bun run db:types --check
```
Expected: Exit code 0 — types are current.
Verification
-
bun run db:typescompletes without errors -
git diff packages/db/shows expected type changes -
bun run db:types --checkpasses (exit code 0) - No TypeScript compilation errors after regeneration
Related Prompts
- Create Migration — Create migration before regenerating types
- Regenerate Migrations Index — Keep migrations index in sync