# Cloudflare D1 database that backs the quotesdb API. # SQLite-compatible; bound to the Worker via the "DB" binding name. # NOTE: D1 must be created before the Worker script (chicken-and-egg). # On first deploy: tofu apply -target=cloudflare_d1_database.quotesdb resource "cloudflare_d1_database" "quotesdb" { account_id = var.cloudflare_account_id name = "quotesdb" } # Export D1 database ID for use in wrangler migration commands. output "d1_database_id" { description = "D1 database ID — use with: wrangler d1 execute quotesdb --file infra/schema.sql --remote" value = cloudflare_d1_database.quotesdb.id }