You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.3 KiB
Markdown

+++
title = "Document D1 schema migration workflow — how to apply SQL schema changes to D1 in CI/CD"
priority = 7
status = "todo"
ticket_type = "task"
dependencies = ["25c413", "d0da0b"]
+++
<context>
Infrastructure is managed with OpenTofu using the Cloudflare provider. Configuration lives in `infra/`. Resources include a Cloudflare Worker (API), Cloudflare D1 database (bound to the worker), and a Cloudflare Pages project (UI frontend).
Cloudflare D1 uses SQL migrations. Because the Worker runs in the Cloudflare runtime (not a standard server), migrations must be applied via a separate mechanism (e.g. `wrangler d1 execute` or a startup script). This workflow must be documented.
</context>
<goal>
Document the D1 schema migration workflow in `infra/README.md` or `docs/MIGRATIONS.md`:
1. How to apply the initial schema SQL to D1 (`wrangler d1 execute --file schema.sql`)
2. How to apply incremental migrations
3. How to apply migrations in CI/CD
4. Where the schema SQL file lives (e.g. `infra/schema.sql` or `src/migrations/`)
5. Cross-reference the TRIAGE decision from ticket 5c0c64 (D1 migrations strategy)
</goal>
<constraints>
- Resolve TRIAGE ticket 5c0c64 before writing this doc — the strategy determines the workflow.
</constraints>
<commit>
`docs(quotesdb): document D1 schema migration workflow`
</commit>