Repository navigation
UF2: the D1 database from Terraform, the schema through db-migrate - #3
Merged
Merged
Conversation
The monitor state's database, provisioned and migrated by Orun before the Worker that binds it deploys: - infra/terraform/cloudflare-d1 (turso-starter's root): one D1 database per deployed environment, named for the product, its id and name lease-published as the WIRING_CLOUDFLARE_D1 document the Worker's config renders from; `terraform validate` passes. - packages/db: the control migration and 010_monitor_state — upstream's init.sql under the table name monitor_state — with turso-starter's runner over D1's REST API; infra/db-migrate runs it, after the D1 apply (enforced on main, advisory on a pull request). - apps/web waits on both: one convergence runs cloudflare-d1 → db-migrate → web per environment. init.sql and `db:init:local` give way to `db:migrate:local`, which applies the same migrations to wrangler's local D1. - tests/db: the migrations through the runner into real SQLite — the checker's own upsert and read on the schema, a second apply applying nothing, the lock, the checksum guard; tests/web holds the table its SQLite stand-in creates to the migration's. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PcpNVpFBcbeiX3EHdXfmn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The monitor state's database, provisioned and migrated by Orun before the Worker that binds it deploys.
infra/terraform/cloudflare-d1(turso-starter's root): one D1 database per deployed environment, its id and name lease-published asWIRING_CLOUDFLARE_D1.terraform validatepasses.packages/db: the control migration and010_monitor_state(upstream'sinit.sql, tablemonitor_state), with turso-starter's runner over D1's REST API;infra/db-migrateruns it after the D1 apply.apps/webnow waits on both (enforced on main, advisory on PRs):cloudflare-d1 → db-migrate → webper environment — confirmed with a localorun planfor a push to main.init.sqlgives way todb:migrate:local.tests/db(14): the migrations into real SQLite, with the checker's own upsert/read, idempotent re-apply, the lock and the checksum guard.tests/web(24) checks its SQLite stand-in creates the same table.Verified locally: install, typecheck, lint, test;
db:migrate:localcreatesmonitor_statein wrangler's local D1.Generated by Claude Code