Database Migrations
Review and apply PostgreSQL migrations with backups and release checks.
PostgreSQL uses its own reviewed migration history.
| Schema | Configuration | Migrations |
|---|---|---|
packages/db/src/schema.ts | packages/db/drizzle.config.ts | packages/db/src/migrations/ |
Postgres
Root commands load apps/web/.env.local through dotenv:
pnpm db:generate
pnpm db:status
pnpm db:migrateFresh installations use the current 0000_initial.sql baseline. pnpm db:push is for development prototypes, not reviewed production migrations. Verify the target connection and back up before production migrations.
Existing Databases
The latest version resets the baseline. Do not apply the new 0000_initial.sql as an upgrade migration to an existing production database. Legacy databases may have old journals and settings tables: back up, compare schema/history on a clone, and design incremental migrations for your derivative. Current root scripts have neither a legacy settings export command nor drizzle:* aliases.
Write failing tests first. Append migrations instead of rewriting applied SQL or faking journals. Test the selected schema, SQL queries, defaults, indexes, and failure recovery before release.