mirror of
https://github.com/hwanny1128/HGZero.git
synced 2025-12-06 07:56:24 +00:00
1.9 KiB
1.9 KiB
minutes_sections 테이블 에러 해결 가이드
문제 상황
Meeting 서비스 시작 시 다음 에러 발생:
Caused by: org.postgresql.util.PSQLException: ERROR: column "id" of relation "minutes_sections" contains null values
원인
minutes_sections테이블에 null id를 가진 레코드가 존재- Hibernate가 id 컬럼을 NOT NULL PRIMARY KEY로 변경하려 시도
- 기존 null 데이터 때문에 ALTER TABLE 실패
해결 방법
방법 1: IntelliJ Database 도구 사용 (권장)
- IntelliJ에서 Database 탭 열기
meetingdb데이터베이스 연결- Query Console 열기
- 다음 SQL 실행:
-- null id를 가진 레코드 삭제
DELETE FROM minutes_sections WHERE id IS NULL;
-- 결과 확인
SELECT COUNT(*) FROM minutes_sections;
방법 2: cleanup-minutes-sections.sql 파일 실행
IntelliJ Database Console에서 cleanup-minutes-sections.sql 파일을 열어서 실행
실행 후
- Meeting 서비스 재시작
- 로그에서 에러가 없는지 확인:
tail -f logs/meeting-service.log | grep -i error - 정상 시작되면 테스트 진행
추가 정보
테이블 구조 확인
SELECT
column_name,
data_type,
is_nullable,
column_default
FROM information_schema.columns
WHERE table_name = 'minutes_sections'
ORDER BY ordinal_position;
현재 데이터 확인
SELECT id, minutes_id, type, title FROM minutes_sections LIMIT 10;
Flyway 마이그레이션 이력 확인
SELECT * FROM flyway_schema_history ORDER BY installed_rank DESC LIMIT 5;
참고사항
- 이 에러는 기존 테이블에 데이터가 있는 상태에서 Entity 구조가 변경되어 발생
- 향후 같은 문제를 방지하려면 Flyway 마이그레이션 파일로 스키마 변경을 관리해야 함
- 테스트 데이터는
test-data-minutes-sections.sql파일 참조