D1: recreate the production database with a US primary

未关闭
#554 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #562 来自 @tombeckenham —— 已关闭,未合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
typescript
领域
database, devops

调研方向

Read wrangler.jsonc and the deployment pipeline, then check whether #553 is restored before attempting the cutover. Pause cron writes, export modelschemas with wrangler d1 export, import into modelschemas-us, and spot-check the listed tables. Deploy the config change, restore crons, verify GET /v1/status and one sync request, then retain the old database for a week.

由索引模型根据 Issue 内容生成。

描述

blocked enhancement

D1 fixes a database's primary location when the database is created, and it can't be changed later. Production should have a US primary. Recreate the database in the same Cloudflare account with a location hint and copy the data across. Users, API keys, subscriptions and history are all kept.

Steps

  • wrangler d1 info modelschemas to record the current location. → running_in_region: OC, 1.01 GB, 19 tables (2026-11-04).
  • wrangler d1 create modelschemas-us --location enam → 21cbfe2e-5a9d-41a8-929e-74089a08230b, region ENAM. enam keeps the primary beside the US_EGRESS Durable Object the cron writers fetch through.
  • Pause the crons so no writes land during the copy (deploy with an empty triggers.crons, or disable them in the dashboard). Writes only come from the crons, plus auth and subscription calls, which are rare.
  • wrangler d1 export modelschemas --remote --output prod.sql, then wrangler d1 execute modelschemas-us --remote --file prod.sql.
  • Spot-check row counts per table (models, schema_versions, changes, subscriptions, better-auth tables).
  • Point d1_databases[0].database_id in wrangler.jsonc at the new database. Keep database_name in step with deploy:ci, which runs migrations by database name. (PR on branch 554-d1-recreate-the-production-database-with-a-us-primary; merge only after the cutover deploy.)
  • Deploy, restore the crons, check GET /v1/status, run one POST /v1/admin/sync/openrouter.
  • Keep the old database for a week, then delete it.

Needs the deploy pipeline back first (#553), or a manual bun run deploy.

Don't reseed instead of copying. The seed doesn't recreate auth users, API keys, agent registrations, webhook subscriptions or checkpoints, or the changes history that /v1/changes cursors point into.

主要语言
TypeScript
星标
0
派生
1
平均合并
5 小时 40 分钟
30 天内合并 PR
193

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/schemas 的其他 Issue

查看 TanStack/schemas 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。