-
Notifications
You must be signed in to change notification settings - Fork 1
feat: TTS 공통 완료 및 리마인드 음원 조회 제공 #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2eae167
build: TTS 미리듣기 음원 마이그레이션 추가
issuejong 22608d2
feat: TTS 공통 음원 응답 모델 구현
issuejong 84ab81a
feat: TTS 공통 음원 메타데이터 마이그레이션 추가
issuejong f0857bd
feat: TTS 공통 음원 URL 조회 구현
issuejong 140d0b0
test: TTS 공통 음원 조회 테스트 추가
issuejong 05e8db2
fix: 빈 DB 초기 스키마 마이그레이션 추가
issuejong aae9fd7
docs: TTS 공통 음원 Swagger 예시 수정
issuejong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
6 changes: 6 additions & 0 deletions
6
src/main/java/com/moru/server/domain/tts/entity/enums/TtsAudioStatus.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package com.moru.server.domain.tts.entity.enums; | ||
|
|
||
| public enum TtsAudioStatus { | ||
| PENDING, | ||
| READY | ||
| } |
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
147 changes: 147 additions & 0 deletions
147
src/main/resources/db/migration/V1__initialize_schema.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| CREATE TABLE IF NOT EXISTS `tts` ( | ||
| `is_pro_only` BIT(1) NOT NULL, | ||
| `selection_version` INT NOT NULL, | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `name` VARCHAR(50) NOT NULL, | ||
| `description` VARCHAR(100) NULL, | ||
| `google_voice_name` VARCHAR(100) NULL, | ||
| `label` VARCHAR(100) NOT NULL, | ||
| `done_audio_key` VARCHAR(500) NULL, | ||
| `preview_audio_key` VARCHAR(500) NULL, | ||
| `remind_audio_key` VARCHAR(500) NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `members` ( | ||
| `onboarding_completed` BIT(1) NOT NULL, | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `tts_id` BIGINT NULL, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `nickname` VARCHAR(50) NULL, | ||
| `profile_image_key` VARCHAR(500) NULL, | ||
| `oauth_id` VARCHAR(255) NOT NULL, | ||
| `login_type` ENUM('APPLE', 'GOOGLE', 'KAKAO', 'NAVER') NOT NULL, | ||
| `role` ENUM('ADMIN', 'MEMBER') NOT NULL, | ||
| PRIMARY KEY (`id`), | ||
| UNIQUE KEY `uk_member_login_type_oauth_id` (`login_type`, `oauth_id`), | ||
| KEY `fk_members_tts` (`tts_id`), | ||
| CONSTRAINT `fk_members_tts` FOREIGN KEY (`tts_id`) REFERENCES `tts` (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `terms` ( | ||
| `is_required` BIT(1) NOT NULL, | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `title` VARCHAR(100) NOT NULL, | ||
| `content` TEXT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `routine_group` ( | ||
| `alarm_time` TIME NULL, | ||
| `is_active` BIT(1) NOT NULL, | ||
| `is_template` BIT(1) NOT NULL, | ||
| `weather_notification_enabled` BIT(1) NOT NULL, | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `member_id` BIGINT NULL, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `alarm_days` VARCHAR(100) NULL, | ||
| `description` VARCHAR(100) NULL, | ||
| `title` VARCHAR(100) NOT NULL, | ||
| `goal_type` ENUM('HABIT', 'HEALTH', 'STABILITY', 'VITALITY') NULL, | ||
| PRIMARY KEY (`id`), | ||
| KEY `fk_routine_group_member` (`member_id`), | ||
| CONSTRAINT `fk_routine_group_member` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `routine` ( | ||
| `order_index` INT NOT NULL, | ||
| `timer` INT NULL, | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `routine_group_id` BIGINT NOT NULL, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `title` VARCHAR(100) NOT NULL, | ||
| `type` ENUM('CHECK', 'INPUT', 'TIMER') NOT NULL, | ||
| PRIMARY KEY (`id`), | ||
| KEY `fk_routine_routine_group` (`routine_group_id`), | ||
| CONSTRAINT `fk_routine_routine_group` FOREIGN KEY (`routine_group_id`) REFERENCES `routine_group` (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `routine_execution` ( | ||
| `actual_wake_time` TIME NULL, | ||
| `duration_second` INT NULL, | ||
| `executed_date` DATE NOT NULL, | ||
| `is_completed` BIT(1) NOT NULL, | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `routine_id` BIGINT NOT NULL, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `ai_response` VARCHAR(500) NULL, | ||
| `member_input` VARCHAR(500) NULL, | ||
| PRIMARY KEY (`id`), | ||
| KEY `fk_routine_execution_routine` (`routine_id`), | ||
| CONSTRAINT `fk_routine_execution_routine` FOREIGN KEY (`routine_id`) REFERENCES `routine` (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `routine_tts` ( | ||
| `order_index` INT NOT NULL, | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `routine_id` BIGINT NOT NULL, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `content` VARCHAR(255) NOT NULL, | ||
| `s3_url` VARCHAR(255) NULL, | ||
| `tts_done` VARCHAR(255) NULL, | ||
| `tts_intro` VARCHAR(255) NULL, | ||
| `tts_status` ENUM('COMPLETED', 'FAILED', 'PENDING') NOT NULL, | ||
| PRIMARY KEY (`id`), | ||
| KEY `fk_routine_tts_routine` (`routine_id`), | ||
| CONSTRAINT `fk_routine_tts_routine` FOREIGN KEY (`routine_id`) REFERENCES `routine` (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `member_term` ( | ||
| `is_agreed` BIT(1) NOT NULL, | ||
| `agreed_at` DATETIME(6) NOT NULL, | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `member_id` BIGINT NOT NULL, | ||
| `term_id` BIGINT NOT NULL, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| PRIMARY KEY (`id`), | ||
| UNIQUE KEY `uk_member_term` (`member_id`, `term_id`), | ||
| KEY `fk_member_term_term` (`term_id`), | ||
| CONSTRAINT `fk_member_term_member` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`), | ||
| CONSTRAINT `fk_member_term_term` FOREIGN KEY (`term_id`) REFERENCES `terms` (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `subscriptions` ( | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `expires_at` DATETIME(6) NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `member_id` BIGINT NOT NULL, | ||
| `started_at` DATETIME(6) NOT NULL, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `store_transaction_id` VARCHAR(255) NULL, | ||
| `plan` ENUM('FREE', 'PRO') NOT NULL, | ||
| `store` ENUM('APP_STORE', 'GOOGLE_PLAYSTORE') NULL, | ||
| PRIMARY KEY (`id`), | ||
| UNIQUE KEY `uk_subscriptions_member` (`member_id`), | ||
| CONSTRAINT `fk_subscriptions_member` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `apple_oauth_credentials` ( | ||
| `created_at` DATETIME(6) NOT NULL, | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `member_id` BIGINT NOT NULL, | ||
| `updated_at` DATETIME(6) NOT NULL, | ||
| `encrypted_refresh_token` TEXT NOT NULL, | ||
| PRIMARY KEY (`id`), | ||
| UNIQUE KEY `uk_apple_oauth_credentials_member` (`member_id`), | ||
| CONSTRAINT `fk_apple_oauth_credentials_member` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
30 changes: 30 additions & 0 deletions
30
src/main/resources/db/migration/V2__add_tts_preview_audio_key.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| SET @preview_audio_key_exists = ( | ||
| SELECT COUNT(*) | ||
| FROM information_schema.columns | ||
| WHERE table_schema = DATABASE() | ||
| AND table_name = 'tts' | ||
| AND column_name = 'preview_audio_key' | ||
| ); | ||
|
|
||
| SET @add_preview_audio_key_sql = IF( | ||
| @preview_audio_key_exists = 0, | ||
| 'ALTER TABLE `tts` ADD COLUMN `preview_audio_key` VARCHAR(500) NULL', | ||
| 'SELECT 1' | ||
| ); | ||
|
|
||
| PREPARE add_preview_audio_key_statement FROM @add_preview_audio_key_sql; | ||
| EXECUTE add_preview_audio_key_statement; | ||
| DEALLOCATE PREPARE add_preview_audio_key_statement; | ||
|
|
||
| UPDATE `tts` | ||
| SET `preview_audio_key` = CASE `name` | ||
| WHEN 'Leda' THEN 'tts/previews/v1/leda.mp3' | ||
| WHEN 'Kore' THEN 'tts/previews/v1/kore.mp3' | ||
| WHEN 'Despina' THEN 'tts/previews/v1/despina.mp3' | ||
| WHEN 'Charon' THEN 'tts/previews/v1/charon.mp3' | ||
| WHEN 'Orus' THEN 'tts/previews/v1/orus.mp3' | ||
| WHEN 'Alnilam' THEN 'tts/previews/v1/alnilam.mp3' | ||
| ELSE `preview_audio_key` | ||
| END | ||
| WHERE (`preview_audio_key` IS NULL OR `preview_audio_key` = '') | ||
| AND `name` IN ('Leda', 'Kore', 'Despina', 'Charon', 'Orus', 'Alnilam'); | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: Team-Moru/moru-server
Length of output: 1442
🏁 Script executed:
Repository: Team-Moru/moru-server
Length of output: 30152
🌐 Web query:
Flyway official documentation baselineOnMigrate empty schema non-empty schema behavior💡 Result:
The baselineOnMigrate configuration setting in Flyway dictates how the tool interacts with schemas when no schema history table is detected [1][2]. Its behavior depends on whether the schema is perceived as empty or non-empty [1][2]. Non-Empty Schema Behavior When baselineOnMigrate is set to true (default is false) and Flyway encounters a non-empty schema without a schema history table, it will automatically execute the baseline command before proceeding with any migrations [1][2]. - The schema is baselined using the configured baselineVersion [1][2]. - Only migrations with a version higher than the baselineVersion will be applied subsequently [1][2]. - This functionality serves as a convenience for initializing Flyway on existing databases, avoiding the need for a separate explicit baseline step [1][2]. Empty Schema Behavior If the database schema is truly empty, baselineOnMigrate has no effect [3]. Flyway will not automatically baseline an empty schema because there is no existing state to baseline [3]. In this scenario, Flyway proceeds with normal migrations starting from the beginning [3]. If you require specific baseline behavior (e.g., skipping initial migration scripts) on an empty schema, setting this parameter will not achieve it; you would instead need to perform an explicit baseline command or use custom migration logic [3]. Important Considerations - Safety: Enabling baselineOnMigrate removes a safety net designed to prevent Flyway from running migrations against the wrong database [1][2]. - Configuration: This setting can be configured via various methods, including environment variables (FLYWAY_BASELINE_ON_MIGRATE), configuration files, or command-line flags (-baselineOnMigrate=true) [1][2][4]. - Versioning: Ensure your baselineVersion is correctly configured to match the state of your existing non-empty database to prevent unintended migration execution [5][6].
Citations:
🏁 Script executed:
Repository: Team-Moru/moru-server
Length of output: 444
🏁 Script executed:
Repository: Team-Moru/moru-server
Length of output: 372
Provision the
ttstable before V1 runs.The migration set contains no
CREATE TABLE tts, and Docker Compose provisions only the database. On an empty database,baseline-on-migrate: truedoes not create a baseline. Flyway runs V1, which fails atALTER TABLE tts. Add a migration that creates the existing schema, or require schema provisioning before Flyway starts.🤖 Prompt for AI Agents