+++
title = "[TRIAGE] Database migration strategy for Cloudflare Workers (startup vs wrangler d1 execute)"
priority = 8
status = "todo"
ticket_type = "task"
dependencies = ["f3dc74"]
+++
This is a triage decision ticket. It must be resolved before dependent implementation tickets can proceed.
Database migration strategy for Cloudflare Workers: how should the `quotes` and `quote_tags` tables be created? Workers do not have a persistent startup phase like a long-running server.
1. **Startup migration** — run `CREATE TABLE IF NOT EXISTS` in the Worker fetch handler before processing the first request. Simple but adds latency to the first request.
2. **`wrangler d1 execute`** — apply the schema separately using the wrangler CLI. No runtime overhead but requires a separate CI step.
3. **SQLx migrate! macro** — embed migrations in the binary and run them at startup. Depends on SQLx compatibility with workers-rs (see TRIAGE e8a330).
1. Research the options above and choose the best approach for this project.
2. Update ticket a5049d (database connection + migrations) with the chosen strategy.
3. Mark this ticket done with a note on the chosen approach in the body or a comment.
`chore(quotesdb): resolve triage — database-migration-strategy-for-cloudflare-workers-startup-v`