Skip to content

Comments

Refactor/79 flyway#80

Merged
zzmnxn merged 12 commits intodevfrom
refactor/79-flyway
Feb 5, 2026
Merged

Refactor/79 flyway#80
zzmnxn merged 12 commits intodevfrom
refactor/79-flyway

Conversation

@zzmnxn
Copy link
Contributor

@zzmnxn zzmnxn commented Feb 3, 2026

🔗 Related Issue

📝 Description

무엇을(What), 왜(Why) 변경했는지 설명합니다.

목적

  • 프로덕션 안정성 향상: JPA의 ddl-auto: update를 제거하고 Flyway로 스키마 버전 관리
  • 스키마 버전 관리: 모든 DDL/DML 변경을 SQL 마이그레이션 파일로 관리
  • 환경 분리: 개발 환경과 운영 환경의 데이터를 명확히 분리

자세한 문서는 docs/flyway-migration 문서를 확인해주세요

🛠 Changes

핵심 변경 사항을 요약합니다.

항목 변경 전 변경 후
스키마 관리 JPA ddl-auto: update Flyway SQL 마이그레이션
초기 데이터 Java DataInitializer, CountryInitializer SQL V2__insert_basic_data.sql, V3__insert_countries.sql
테스트 데이터 Java 코드 SQL V4__test_user.sql (개발 전용)
스키마 검증 자동 생성 ddl-auto: validate + Flyway 검증

✅ Test Checklist

변경 사항이 정상적으로 동작하는지 확인하기 위해 수행한 테스트 목록입니다.

  • 단위 테스트(Unit Test) 수정 및 통과 확인
  • 로컬 test db에서 새로운 테이블 생성 확인

zzmnxn added 12 commits February 2, 2026 14:10
* Added Flyway core and MySQL dependencies in build.gradle
* Enabled Flyway in application configurations for both production and default profiles
* Configured Flyway settings including baseline and validation options

This update facilitates database version control and migration management.
* Deleted CountryInitializer and DataInitializer classes as they are no longer needed.
* Added initial SQL migration scripts for database schema and basic data setup, including country, emotion, weather, trip theme, and user data.

This cleanup streamlines the initialization process and leverages database migrations for data management.
…dGenerateTokens method

* Refactored LoginServiceTest to replace login method with loginAndGenerateTokens.
* Updated assertions to reflect changes in response structure.
* Adjusted test data and mock setups in LoginControllerTest for consistency.
* Removed deprecated init tests in CountryServiceTest as they are now handled by Flyway migrations.
* Added Clock mocking in AlarmPolicyServiceTest and AlarmServiceTest for consistent time handling.
…ion handling

* Replaced when().thenThrow() with doThrow().when() for better readability and clarity in the test setup.
* This change enhances the exception handling in the test for invalid refresh tokens.
@zzmnxn zzmnxn linked an issue Feb 3, 2026 that may be closed by this pull request
5 tasks
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

Copy link
Contributor

@chwwwon chwwwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨어요..!!!
수정할만한 사항은 없어보이니 아래 리뷰 하나만 확인해주시고 머지하면 될 것 같습니당


-- DiaryImage 테이블 (FK: Diary)
CREATE TABLE IF NOT EXISTS `DiaryImage` (
`DiaryImageId` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 여기서 DiaryImageId는 일부러 대문자로 시작하신건가용?
다른건 모두 첫글자 소문자로 시작되어서요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

에, 왜 그것만 대문자인지 기억이 안 나네요... 흠 아마 원래 엔티티에 있던 컬럼명을 그대로 사용하느라 그런 것 같아요!

@zzmnxn zzmnxn merged commit 8834b99 into dev Feb 5, 2026
1 of 2 checks passed
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.

[REFACTOR] DB-migration (Flyway 도입)

2 participants