From 6887470b576a8b6ebfdee13102da5a2d6d65cfe3 Mon Sep 17 00:00:00 2001 From: 1Seob Date: Mon, 12 Jan 2026 20:20:25 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor(db):=20Flyway=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=EA=B7=B8=EB=A0=88=EC=9D=B4=EC=85=98=20sql=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60112_1947__IS_refactor_emotions_table.sql | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/resources/db/migration/V20260112_1947__IS_refactor_emotions_table.sql diff --git a/src/main/resources/db/migration/V20260112_1947__IS_refactor_emotions_table.sql b/src/main/resources/db/migration/V20260112_1947__IS_refactor_emotions_table.sql new file mode 100644 index 0000000..46e1444 --- /dev/null +++ b/src/main/resources/db/migration/V20260112_1947__IS_refactor_emotions_table.sql @@ -0,0 +1,33 @@ +-- color_code 컬럼 삭제 +ALTER TABLE emotions +DROP COLUMN IF EXISTS color_code; + + +-- 새로운 emotions 레코드들 생성 +-- (기존에 존재하는 '즐거움', '후회', '기타'를 제외한 신규 감정만 추가) +INSERT INTO emotions (code, name) VALUES + ('ACHIEVEMENT', '성취'), + ('INTEREST', '흥미'), + ('PEACE', '평온'), + ('WILL', '의지'), + ('DEPRESSION', '우울'); + + +-- 2. 삭제 예정인 감정들의 emotion_id를 '기타(ETC)'의 id로 변경 +-- 삭제 대상: 기쁨(JOY), 슬픔(SADNESS), 분노(ANGER), 좌절(FRUSTRATION), 성장(GROWTH) +UPDATE daily_reports +SET emotion_id = ( + SELECT id + FROM emotions + WHERE code = 'ETC' +) +WHERE emotion_id IN ( + SELECT id + FROM emotions + WHERE code IN ('JOY', 'SADNESS', 'ANGER', 'FRUSTRATION', 'GROWTH') +); + + +-- 겹치지 않는(삭제 예정인) emotions 레코드 삭제 +DELETE FROM emotions +WHERE code IN ('JOY', 'SADNESS', 'ANGER', 'FRUSTRATION', 'GROWTH'); \ No newline at end of file From 09620473ff78dc9abba9275af487c2d84729eb8d Mon Sep 17 00:00:00 2001 From: 1Seob Date: Mon, 12 Jan 2026 20:21:46 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20emotions=20=EB=A0=88=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dailyreport/api/DailyReportController.java | 10 +++++----- .../domain/dailyreport/core/entity/Emotion.java | 3 --- .../domain/dailyreport/core/entity/EmotionCode.java | 12 +++++------- .../domain/dailyreport/core/entity/EmotionName.java | 12 +++++------- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/api/DailyReportController.java b/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/api/DailyReportController.java index 1632de0..bf8a62b 100644 --- a/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/api/DailyReportController.java +++ b/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/api/DailyReportController.java @@ -44,13 +44,13 @@ public class DailyReportController { | 응답의 emotion | 해당 감정 | | :--- | :--- | - | `JOY` | 기쁨 | + | `ACHIEVEMENT` | 성취 | + | `INTEREST` | 흥미 | + | `PEACE` | 평온 | | `PLEASURE` | 즐거움 | - | `SADNESS` | 슬픔 | - | `ANGER` | 분노 | + | `WILL` | 의지 | + | `DEPRESSION` | 우울 | | `REGRET` | 후회 | - | `FRUSTRATION` | 좌절 | - | `GROWTH` | 성장 | | `ETC` | 기타 | """, security = @SecurityRequirement(name = "bearerAuth"), diff --git a/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/Emotion.java b/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/Emotion.java index f58a4c4..4332417 100644 --- a/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/Emotion.java +++ b/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/Emotion.java @@ -22,7 +22,4 @@ public class Emotion { @Enumerated(EnumType.STRING) @Column(name = "name",nullable = false, length = 50) private EmotionName name; - - @Column(name = "color_code", length = 50) - private String colorCode; } \ No newline at end of file diff --git a/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/EmotionCode.java b/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/EmotionCode.java index e079c6b..faa031c 100644 --- a/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/EmotionCode.java +++ b/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/EmotionCode.java @@ -1,14 +1,12 @@ package com.devkor.ifive.nadab.domain.dailyreport.core.entity; public enum EmotionCode { - JOY, + ACHIEVEMENT, + INTEREST, + PEACE, PLEASURE, - LOVE, - SADNESS, - ANGER, - PAIN, + WILL, + DEPRESSION, REGRET, - FRUSTRATION, - GROWTH, ETC } diff --git a/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/EmotionName.java b/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/EmotionName.java index 5a0d376..9f5537d 100644 --- a/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/EmotionName.java +++ b/src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/entity/EmotionName.java @@ -1,14 +1,12 @@ package com.devkor.ifive.nadab.domain.dailyreport.core.entity; public enum EmotionName { - 기쁨, + 성취, + 흥미, + 평온, 즐거움, - 사랑, - 슬픔, - 분노, - 고통, + 의지, + 우울, 후회, - 좌절, - 성장, 기타 }