hgzero/meeting/README-FIX-MINUTES-SECTIONS.md

73 lines
1.9 KiB
Markdown

# 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 도구 사용 (권장)
1. IntelliJ에서 Database 탭 열기
2. `meetingdb` 데이터베이스 연결
3. Query Console 열기
4. 다음 SQL 실행:
```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` 파일을 열어서 실행
## 실행 후
1. Meeting 서비스 재시작
2. 로그에서 에러가 없는지 확인:
```bash
tail -f logs/meeting-service.log | grep -i error
```
3. 정상 시작되면 테스트 진행
## 추가 정보
### 테이블 구조 확인
```sql
SELECT
column_name,
data_type,
is_nullable,
column_default
FROM information_schema.columns
WHERE table_name = 'minutes_sections'
ORDER BY ordinal_position;
```
### 현재 데이터 확인
```sql
SELECT id, minutes_id, type, title FROM minutes_sections LIMIT 10;
```
### Flyway 마이그레이션 이력 확인
```sql
SELECT * FROM flyway_schema_history ORDER BY installed_rank DESC LIMIT 5;
```
## 참고사항
- 이 에러는 기존 테이블에 데이터가 있는 상태에서 Entity 구조가 변경되어 발생
- 향후 같은 문제를 방지하려면 Flyway 마이그레이션 파일로 스키마 변경을 관리해야 함
- 테스트 데이터는 `test-data-minutes-sections.sql` 파일 참조