[BE] Entity를 변경하고 다시 시작해도, db에 반영이 안되는 이유 #125
2020147542
started this conversation in
General
Replies: 2 comments 2 replies
-
1. 로컬 환경volumes:
- data:/var/lib/mysql # Named Volume 방식
2. 프로덕션 환경volumes:
- /home/ubuntu/deploy-db:/var/lib/mysql # Bind Mount 방식
이래서 로컬은 |
Beta Was this translation helpful? Give feedback.
1 reply
-
사실 더 좋은 방법 있음Flyway 같은 DB 마이그레이션 도구를 쓰는 것도 좋음 // build.gradle
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'Flyway 쓰면:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
문제 상황
Entity 변경하고 애플리케이션 재시작했는데 DB에 반영이 안되는 문제가 발생했음. Docker로 MySQL 실행하면서 volumes 쓰고 있음
docker/local/docker-compose.yml 내부
docker/deploy/docker-compose.yml 내부
원인
Docker volume이 데이터를 보존하는 저장소임. 스프링 어플리케이션을 재시작해도 이전 데이터가 그대로 남아있어서 변경된 Entity가 반영이 안 되는 것임
Beta Was this translation helpful? Give feedback.
All reactions