chore: 로컬 개발 DB docker-compose 전환 (sha256_password 접속오류 해결)#151
chore: 로컬 개발 DB docker-compose 전환 (sha256_password 접속오류 해결)#151chanwoo7 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧹 knip — dead-code 리포트전체 리포트
|
🩺 NestJS Doctor — 88/100 (Good)진단 254건 (error 0).
architecture / security 상위 항목
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d59d5e5261
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| command: | ||
| - --character-set-server=utf8mb4 | ||
| - --collation-server=utf8mb4_unicode_ci |
There was a problem hiding this comment.
Keep the MySQL auth workaround in dev compose
When a developer starts a fresh DB with this new file, the caquick user is created with MySQL 8's default auth because this command omits the workaround already used in docker-compose.yml:5-9 and the init script's ALTER USER in docker/mysql/init/01-grant-shadow-db.sql:5-8. The repo documents that Prisma 6.x can surface that default as the unsupported sha256_password, so this dev compose can reproduce the startup error the change is intended to avoid.
Useful? React with 👍 / 👎.
| - --character-set-server=utf8mb4 | ||
| - --collation-server=utf8mb4_unicode_ci | ||
| volumes: | ||
| - caquick-mysql-data:/var/lib/mysql |
There was a problem hiding this comment.
Grant the dev user shadow-database privileges
When this local DB is used with the existing dev migration flow (README.md:252-253 / package.json:22-23), Prisma migrate dev needs to create a shadow database; the existing init SQL grants that explicitly in docker/mysql/init/01-grant-shadow-db.sql:1-3. This new compose only mounts the data volume, so a fresh MYSQL_USER is limited to the CaQuick database and local migration creation will fail unless the init directory is mounted or equivalent CREATE/ALL privileges are granted.
Useful? React with 👍 / 👎.
Coverage report
Test suite run success1344 tests passing in 159 suites. Report generated by 🧪jest coverage report action from d59d5e5 |
|
기존 docker-compose.yml 이 이미 동일 목적(mysql_native_password 로 Prisma sha256 인식 이슈 회피)으로 존재함을 확인. 중복이라 close 합니다. 실제 원인은 caquick-mysql 컨테이너 미기동 + 네이티브 brew mysql 의 3306 점유였음. |
Summary
로컬 개발 DB를 docker-compose로 전환합니다. 네이티브 brew MySQL의
sha256_password계정으로yarn start가 막히던 문제를 해결합니다.배경
mysql@8.4(brew)의caquick계정이sha256_password인증 플러그인 → Prisma 쿼리 엔진이 미지원(caching_sha2_password/mysql_native_password만 지원) →PrismaClientInitializationError: Unknown authentication plugin 'sha256_password'.mysql:8.0컨테이너는 기본 인증이caching_sha2_password라 Prisma와 호환.변경
docker-compose.dev.yml추가 — 로컬 개발용 MySQL(8.0). 자격증명(caquick/caquick/CaQuick)·포트 3306·named volume(데이터 영속)·healthcheck 포함..env.example의 기존DATABASE_URL(mysql://caquick:caquick@localhost:3306/CaQuick)과 그대로 일치 →.env변경 불필요.사용법
Test plan
migrate deploy(8 migrations 적용) →prisma:seed(지역 마스터 + 테스트 계정) →yarn start가 DB 연결을 통과해 listen 단계 도달(=sha256_password오류 해소).docker-compose.dev.yml)만.