Files
Hyungi Ahn aceb54e586 fix(migrations): 143 asyncpg multi-statement 분리
asyncpg prepared statement 는 single-command 만 지원 (core/database.py
exec_driver_sql 경로). §1 의 143_category.sql 이 4 statement (TYPE +
ALTER + INDEX×2) 였어서 fastapi 부팅 시 asyncpg.PostgresSyntaxError
"cannot insert multiple commands into a prepared statement" 로 실패
→ 컨테이너 restart 루프.

143 을 4 개 파일로 분리:
  143: CREATE TYPE doc_category
  144: ALTER TABLE documents ADD category / ai_suggestion
  145: CREATE INDEX idx_documents_category
  146: CREATE INDEX idx_documents_has_suggestion (partial)

DB 상태는 깨끗 (migration 143 이 부분 적용 안 됨 — asyncpg 가 batch
자체를 reject). schema_migrations 에 143 도 미기록이라 재실행 안전.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 15:46:00 +09:00

19 lines
694 B
SQL

-- 143_category.sql
-- Document Server 통합 플랫폼 Section 1: doc_category enum 정의 (1/4)
-- plan: luminous-sprouting-hamster.md §1
--
-- asyncpg prepared statement 는 single-command 만 허용.
-- 원래 한 파일이던 §1 스키마 변경을 4개로 분리:
-- 143: CREATE TYPE doc_category
-- 144: ALTER TABLE documents ADD category / ai_suggestion
-- 145: CREATE INDEX idx_documents_category
-- 146: CREATE INDEX idx_documents_has_suggestion
--
-- 6 활성: document / library / news / memo / audio / video
-- 3 유보: mail / calendar / plex
CREATE TYPE doc_category AS ENUM (
'document', 'library', 'news', 'memo', 'audio', 'video',
'mail', 'calendar', 'plex'
);