Skip to content

feat(db): migrate api to d1#35

Draft
risu729 wants to merge 1 commit into
mainfrom
codex-20260520-112032-091405
Draft

feat(db): migrate api to d1#35
risu729 wants to merge 1 commit into
mainfrom
codex-20260520-112032-091405

Conversation

@risu729
Copy link
Copy Markdown
Member

@risu729 risu729 commented May 20, 2026

Summary

  • migrate the API and Drizzle schema from Supabase/Postgres/PostGIS to Cloudflare D1
  • remove geospatial DB usage and use numeric lat/lng radius calculations in API code
  • add D1 schema/reset/migration files, bind DB in Wrangler, and apply D1 migrations in deploy workflow
  • remove Supabase secrets/docs and update DB setup docs for D1

D1

  • created jematala-db in Cloudflare D1
  • database ID: 816d5f5d-0be0-4122-88a9-f4bcee86892e
  • applied 0001_initial.sql to the remote D1 database

Verification

  • bun run check
  • bun run build:api
  • bun run --cwd packages/db reset:local
  • local D1 smoke query: 6 POIs, 32 level quests; rotation SQL inserts 5 active POIs
  • remote D1 smoke query: 6 POIs, 32 level quests, 5 active daily quest rows

Notes

  • The CLOUDFLARE_API_TOKEN in the main worktree .env did not have D1 permissions, so I used existing Wrangler auth after sourcing the account ID. CI CLOUDFLARE_API_TOKEN needs D1 migration permissions for the new deploy step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant