Conversation
vite/svelte config 가 빌드 시점에 스키마·드라이버를 선택하므로 빌드 env 로 지정하지 않으면 d1 로 번들링되어 런타임에 postgres 드라이버가 없다. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- scripts/lib/db.ts 신규: 방언 인식 node 용 DB 헬퍼 (pg=postgres-js, mysql=mysql2, sqlite=libsql 직결, d1=sqlite-proxy 로 D1 REST 래핑) - seed.ts: D1 REST raw SQL → drizzle ORM 재작성. Date 객체로 방언별 timestamp 직렬화를 drizzle 에 위임. SEED_RESET/non-TTY 비대화 가드 추가 - seed-migrate.ts: seed/db/*.sql 적용을 방언별 execRaw 로 라우팅, _seed_migrations DDL 방언화 - setup.ts: --dialect/--database-url/--hyperdrive-id 추가. main 을 d1 경로 / 직결(pg·mysql·sqlite) 경로로 분기, 직결 경로는 seed.ts 재사용 - package.json: db:migrate/seed/push/studio 에 :pg/:mysql/:sqlite 추가 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- README: setup 마법사 방언 분기 흐름, db:migrate:pg/db:seed:pg 등 새 스크립트 표, Hyperdrive 자동 설정·postgres 시드 예시 - IDP_BOOTSTRAP_ADMIN_* / SEED_RESET 수동·CI 시드 방법 반영 (기존 "D1 전용, 미사용" 문구는 스크립트 재작성으로 낡음) - seed/README: seed 마이그레이션 전 방언 적용 및 공통 SQL 문법 주의 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
.gitignore 에서 drizzle/ 제외를 해제해 마이그레이션 SQL·journal 을 커밋한다 (drizzle-kit migrate 가 CI/새 환경에서 동일 스키마를 적용할 수 있도록). - drizzle/ : 기존 D1 마이그레이션 (0000~0017) - drizzle/pg/ : PostgreSQL 초기 마이그레이션 (db:generate:pg) - drizzle/mysql/ : MySQL 초기 마이그레이션 (db:generate:mysql) - drizzle/sqlite/ : libSQL/SQLite 초기 마이그레이션 (db:generate:sqlite) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
배포 DB를 D1에서 PostgreSQL(Hyperdrive) 로 전환하고, 그동안 D1 전용이던 setup/seed 파이프라인을 4방언(d1 / sqlite / postgres / mysql) 공용으로 재작성했습니다.
커밋 구성
0bf6d08fix(deploy)DB_DIALECT=postgres지정 — 미지정 시 d1로 번들링되어 런타임에 postgres 드라이버가 없음df16764feat(scripts)scripts/lib/db.ts신규(방언 인식 node용 DB 헬퍼),seed.ts를 D1 REST raw SQL → drizzle ORM 재작성(Date 객체로 방언별 timestamp 직렬화 위임),seed-migrate.ts방언화,setup.ts에--dialect/--database-url/--hyperdrive-id직결 경로 추가,db:migrate:pg·db:seed:pg등 npm 스크립트 추가3dc033cdocs7831305chore(db).gitignore에서drizzle/제외 해제 — 마이그레이션 SQL·journal을 git 추적으로 전환, 4방언 초기 마이그레이션 포함검증
timestamptz+ drizzleDate왕복 — live DB에서 밀리초 일치 확인--dialect sqlite --yes)db:migrate:pg28테이블 +db:seed:pg관리자 시드 → 행 검증DB_DIALECT=postgres빌드: postgres-js 번들 포함·d1 드라이버 제거 확인배포 참고
WRANGLER_JSONC시크릿은wrangler.prod.jsonc(HYPERDRIVE 바인딩 +DB_DIALECT=postgres) 내용으로 갱신됨 — 머지 시 main 푸시 배포가 postgres 구성으로 나감idp(2204a44a…)의 origin은 격리된keystone@keystone(admin 계정 아님)🤖 Generated with Claude Code