D1: recreate the production database with a US primary

オープン
#554 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #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分
マージ済み PR(30日)
193

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/schemas のほかの issue

TanStack/schemas の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。