Write apps/backend/docs/migrations.md covering the drizzle-kit workflow: editing src/db/schema.ts, running pnpm db:generate, reviewing the emitted SQL, and pnpm db:migrate. Explain the drizzle/ layout — the .sql files, meta/_journal.json, and the per-migration snapshots.
Acceptance criteria:
- Explains that
schema.ts is the source of truth and migrations are generated from it, never hand-written first
- Documents
meta/_journal.json as the file that decides which migrations actually run, and that a migration file not listed there is silently skipped
- Documents the merge hazard concretely: parallel branches each generating a migration produce colliding prefixes and duplicated journal entries — this has already broken this repo's history once
- Gives the recommended procedure for resolving a migration conflict during a merge
- Notes that
drizzle/meta/ is Prettier-ignored because it is generated output
Write
apps/backend/docs/migrations.mdcovering the drizzle-kit workflow: editingsrc/db/schema.ts, runningpnpm db:generate, reviewing the emitted SQL, andpnpm db:migrate. Explain thedrizzle/layout — the.sqlfiles,meta/_journal.json, and the per-migration snapshots.Acceptance criteria:
schema.tsis the source of truth and migrations are generated from it, never hand-written firstmeta/_journal.jsonas the file that decides which migrations actually run, and that a migration file not listed there is silently skippeddrizzle/meta/is Prettier-ignored because it is generated output