Skip to content

Commit 028c217

Browse files
authored
Merge pull request #154 from Team-Prezel/develop
[DEPLOY]
2 parents c1d430a + 41a42dd commit 028c217

2 files changed

Lines changed: 21 additions & 22 deletions

File tree

src/main/java/com/finger/handoff/domain/curation/controller/CurationInitController.java

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,32 @@ public class CurationInitController {
2020
@PostMapping("/init-curations")
2121
@Transactional
2222
public ResponseEntity<String> initCurations() {
23-
// ★★★ [해결 핵심 1줄 추가!] 기존에 꼬인 테이블이나 중복 데이터가 있으면 싹 지우고 새로 시작! ★★★
23+
jdbcTemplate.execute("DROP TABLE IF EXISTS curation;");
2424
jdbcTemplate.execute("DROP TABLE IF EXISTS presentation_contents;");
25-
log.info("기존 presentation_contents 테이블 초기화(DROP) 완료");
25+
log.info("기존 테이블 초기화(DROP) 완료");
2626

27-
// 1. 테이블 생성 DDL
2827
String createTableSql = """
29-
CREATE TABLE presentation_contents (
30-
id INT PRIMARY KEY,
31-
category VARCHAR(50) NOT NULL,
32-
d_day_type VARCHAR(50) NOT NULL,
33-
theme VARCHAR(255) NOT NULL,
34-
order_num INT NOT NULL,
35-
media_type VARCHAR(20) NOT NULL,
36-
content_title VARCHAR(255) NOT NULL,
37-
author_channel VARCHAR(100) NOT NULL,
38-
url TEXT NOT NULL,
39-
thumbnail_url TEXT NOT NULL
28+
CREATE TABLE curation (
29+
id BIGINT PRIMARY KEY,
30+
presentation_type VARCHAR(50) NOT NULL,
31+
d_day_range VARCHAR(50) NOT NULL,
32+
guide_message VARCHAR(255) NOT NULL,
33+
recommend_order INT NOT NULL,
34+
material_type VARCHAR(50) NOT NULL,
35+
title VARCHAR(255) NOT NULL,
36+
source_channel VARCHAR(100) NOT NULL,
37+
link_url VARCHAR(500) NOT NULL,
38+
image_url VARCHAR(500) NOT NULL
4039
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4140
""";
4241

4342
jdbcTemplate.execute(createTableSql);
44-
log.info("presentation_contents 테이블 생성 완료");
43+
log.info("curation 테이블 생성 완료");
4544

46-
// 2. 데이터 삽입 DML (이전과 동일한 1번~96번 데이터)
45+
// 3. 컬럼명 완벽 매핑 + URL 깨짐 복원 완료된 96개 데이터 삽입 DML
4746
String insertSql = """
48-
INSERT INTO presentation_contents
49-
(id, category, d_day_type, theme, order_num, media_type, content_title, author_channel, url, thumbnail_url)
47+
INSERT INTO curation
48+
(id, presentation_type, d_day_range, guide_message, recommend_order, material_type, title, source_channel, link_url, image_url)
5049
VALUES
5150
(1,'EDUCATION','D_7_PLUS','발표 흐름을 키워드별로 정리해보세요',1,'영상','학부생을 위한 자료 조사 한 방에 정리하기!','DBpia','https://www.youtube.com/watch?v=YRxDWjfCNk0','https://img.youtube.com/vi/YRxDWjfCNk0/hqdefault.jpg'),
5251
(2,'EDUCATION','D_7_PLUS','발표 흐름을 키워드별로 정리해보세요',2,'영상','말하기의 핵심은 바로 ''키워드'' 입니다.','김홍국TV','https://www.youtube.com/watch?v=24jkZg_dw5w','https://img.youtube.com/vi/-fLRKwy6SRA/hqdefault.jpg'),
@@ -147,8 +146,8 @@ author_channel VARCHAR(100) NOT NULL,
147146
""";
148147

149148
jdbcTemplate.execute(insertSql);
150-
log.info("큐레이션 데이터 96건 삽입 완료");
149+
log.info("curation 테이블에 96건 데이터 매핑 완료");
151150

152-
return ResponseEntity.ok("큐레이션 테이블 생성 및 96개 데이터 성공적으로 삽입되었습니다! 🚀");
151+
return ResponseEntity.ok("curation 테이블 생성 및 96개 데이터 성공적으로 삽입되었습니다! 🚀");
153152
}
154153
}

src/main/java/com/finger/handoff/domain/curation/entity/CurationData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public class CurationData {
1616
private Long id;
1717

1818
@Enumerated(EnumType.STRING)
19-
@Column(name = "category")
19+
@Column(nullable = false)
2020
private PresentationType presentationType;
2121

2222
@Enumerated(EnumType.STRING)
23-
@Column(name = "d_day_type")
23+
@Column(nullable = false)
2424
private DDayRange dDayRange;
2525

2626
@Column(nullable = false)

0 commit comments

Comments
 (0)