Database migrations
Ordered historical schema changes. The current schema is src/lib/db/schema.ts; apply history through the migration runner.
System explanation · Choosing checks
Use bun run db:status and bun run db:migrate. For a schema
change, update the source schema, run bun run db:generate, inspect the SQL
and metadata, and exercise the migration against an existing development dataset.
db:push exists but does not replace this versioned migration workflow. Do not
edit applied SQL to repair schema drift.
Source files
| File | Responsibility / entry points |
|---|---|
drizzle/0000_unknown_hellion.sql
|
Creates versioned snapshots using the original number-based key. |
drizzle/0001_abandoned_richard_fisk.sql
|
Adds review index and inbox events/visits/touches. |
drizzle/0002_nosy_guardian.sql
|
Adds query indexes and initial projection/event backfill. |
drizzle/0003_daily_silver_samurai.sql
|
Adds catalog fields, read versions and personal flags. |
drizzle/0004_steady_lord_hawal.sql
|
Adds report JSON projection. |
drizzle/0005_mature_the_professor.sql
|
Adds published policy tables and resets legacy report projection for changed eligibility. |
drizzle/0006_fiscal_year_review_keys.sql
|
Historical conversion to FFY-qualified text review keys, including legacy orphan handling. |
drizzle/0007_opaque_review_identity.sql
|
Current UUID conversion across all references and JSON IDs; adds fiscal_year and unique business identity. |
drizzle/0008_report_required.sql
|
Makes the report projection required. Fails without changes if a row has none. |
drizzle/meta/_journal.json
|
Ordered migration journal. SQL snapshots under meta/ support Drizzle generation; the runner checks applied history. |