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>