Skip to content

[DP-467] post_type NULL 마이그레이션 — 기존 게시글 AI 답변 섹션 미표시 버그 수정#164

Merged
github-actions[bot] merged 1 commit into
developV2from
auto/fix/DP-467-post-type-null-migration
May 7, 2026
Merged

[DP-467] post_type NULL 마이그레이션 — 기존 게시글 AI 답변 섹션 미표시 버그 수정#164
github-actions[bot] merged 1 commit into
developV2from
auto/fix/DP-467-post-type-null-migration

Conversation

@nYeonG4001
Copy link
Copy Markdown
Collaborator

Summary

  • post_type 컬럼 추가 전 생성된 기존 게시글의 post_type이 NULL → 프론트에서 AI 답변 섹션 미표시
  • data.sql에 idempotent DO $$ 블록 추가: NULL 행을 TECH로 백필 후 NOT NULL 제약 적용
  • Java 엔티티(Post.java)는 이미 @Column(nullable = false) 선언되어 있어 코드 변경 불필요

Root Cause

ddl-auto: update는 신규 컬럼 추가 시 기존 row를 NULL로 남김 → PostDetailResponsepostType: null 직렬화 → 프론트 조건 postType === "TECH" false → AI 서버 미호출

Migration (data.sql — 앱 시작 시 자동 실행, idempotent)

UPDATE posts SET post_type = 'TECH' WHERE post_type IS NULL;
-- is_nullable = 'YES' 인 경우에만 NOT NULL 제약 추가 (중복 실행 안전)
ALTER TABLE posts ALTER COLUMN post_type SET NOT NULL;

Test plan

  • ./gradlew build --no-daemon 통과 (빌드 + 테스트 전체)
  • SQL 변경만이므로 신규 Java 코드 없음 → SonarCloud 커버리지 항목 해당 없음
  • data.sql DO $$ 블록은 이미 존재하는 패턴(DP-462)과 동일 방식 — idempotent 보장

@github-actions github-actions Bot merged commit dbb3c80 into developV2 May 7, 2026
2 checks passed
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

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.

1 participant