Skip to content

Database migration workflow guide #546

Description

@codebestia

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programdatabasedocumentationImprovements or additions to documentationdx

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions