Files
hyungi_document_server/migrations/155_analyze_events_policy_violation_idx.sql
Hyungi Ahn c9e8dd0ba1 fix(db): split migration 153 for asyncpg single-statement limit
asyncpg exec_driver_sql 이 prepared statement 로 multiple commands 를
허용하지 않아 배포 시 PostgresSyntaxError: cannot insert multiple commands
into a prepared statement 로 init_db() 실패.

153 를 단일 ALTER TABLE (10 ADD COLUMN) 로 축소하고 2 partial index 를
154/155 로 분리:

- 153_analyze_events_shadow.sql: ALTER TABLE ADD COLUMN (단일 statement)
- 154_analyze_events_shadow_idx_ts.sql: idx_analyze_events_shadow_ts
- 155_analyze_events_policy_violation_idx.sql: idx_analyze_events_policy_violation

배포 test: GPU fastapi 컨테이너 재빌드 후 init_db 가 153/154/155 세 파일을
순차 적용 (asyncpg prepared statement 1 파일 1 문).

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

8 lines
331 B
SQL

-- 155_analyze_events_policy_violation_idx.sql
-- PR-A: policy_violation=true 행 추출 인덱스 (migration 153 분할).
-- under_escalation 재처리 큐 + 야간 sweep 감사용 partial index.
CREATE INDEX IF NOT EXISTS idx_analyze_events_policy_violation
ON analyze_events (created_at)
WHERE policy_violation = true;