chore: add db:migrate scripts and document the D1 migration step

- Add npm scripts db:migrate (local) and db:migrate:prod (remote) for
  wrangler d1 migrations apply webhooker
- Document the D1 database creation + migration step in the deployment
  guides (README en/zh, docs en/zh) and AGENTS.md
- Note the d1 execute fallback for databases already migrated manually
This commit is contained in:
wyf9 2026-08-05 17:39:14 +08:00
parent afe19795b1
commit cb18683fb8
No known key found for this signature in database
GPG key ID: B126966081BFDBE4
6 changed files with 89 additions and 13 deletions

View file

@ -145,9 +145,7 @@ npx wrangler kv namespace create KV
# Update wrangler.jsonc with KV ID
npx wrangler d1 create webhooker
# Update wrangler.jsonc d1_databases with the database ID
npx wrangler d1 execute webhooker --remote --file ./migrations/0001_init.sql
npx wrangler d1 execute webhooker --remote --file ./migrations/0002_log_detail.sql
npx wrangler d1 execute webhooker --remote --file ./migrations/0003_telegram_links.sql
npm run db:migrate:prod # wrangler d1 migrations apply webhooker --remote (migrations/0001..0003)
npx wrangler deploy
```