← スキル一覧に戻る

d1-drizzle-migrations
by ldsgroups225
⭐ 0🍴 0📅 2026年1月24日
SKILL.md
name: d1-drizzle-migrations description: Use this when changing the database schema, generating/applying Drizzle migrations for Cloudflare D1 (SQLite), or working with Better Auth schema generation.
Cloudflare D1 + Drizzle migrations (via packages/data-ops)
Use this skill when the user asks to add or modify tables, regenerate auth schema, generate migration SQL, or apply migrations locally/remote.
Hard rules (architecture)
- Do not define DB schemas in apps.
- Always define schemas in
packages/data-ops/src/drizzle/and import from there.
Better Auth schema
- Generate auth schema:
pnpm run --filter data-ops better-auth:generate
Drizzle migrations
-
Generate SQL migrations:
pnpm run --filter data-ops drizzle:generate
-
Run migrations (uses the
packages/data-opsscriptdrizzle:migrate):pnpm run --filter data-ops drizzle:migrate
Apply migrations
-
Apply locally (recommended):
- Run the user app at least once so a local D1 SQLite file exists under
apps/user-application/.wrangler/state/.... - Then run:
pnpm run --filter data-ops drizzle:migrate
- Run the user app at least once so a local D1 SQLite file exists under
-
Apply locally (manual / fallback, run from
apps/user-application):npx wrangler d1 execute DB --local --file=../../packages/data-ops/src/drizzle/<migration_file>.sql
-
Apply remotely (D1 HTTP driver):
NODE_ENV=production pnpm run --filter data-ops drizzle:migrate
Remote migrate requires CLOUDFLARE_ACCOUNT_ID (or CLOUDFLARE_D1_ACCOUNT_ID), CLOUDFLARE_DATABASE_ID, and CLOUDFLARE_D1_TOKEN (or CLOUDFLARE_D1_API_TOKEN).
Verification
- After schema changes, rebuild the shared library:
pnpm run build:data-ops
- If runtime bindings/types changed, regenerate worker types (see worker typegen skill).
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です