[Feat&Mod] flyway 세팅 및 docker-compose 파일 수정 #122
Merged
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.
추가한 코드
build.gradle
-implementation 'org.flywaydb:flyway-mysql'
추가V1__init.sql
- 기존에 JPA를 사용하여 엔티티가 자동으로 데이터베이스에 생성되었던 부분을 SQL 스크립트를 직접 작성하여 테이블을 생성docker-compose.yml
- mysql-container와의 연결 부분 삭제flyway
db 마이그레이션 툴 사용 계기
flyway 채택 이유
flyway 역할
flyway 동작 방식
(마이그레이션 파일은 DB 변경이 필요할 때마다 개발자가 직접 SQL 파일을 작성)
간단히 요약하자면, sql 마이그레이션 파일로 db를 형상 관리하고
spring.jpa.hibernate.ddl-auto=validate
옵션을 활용한 검증을 하도록 설정하였습니다.