Files
hyungi_document_server/migrations/154_analyze_events_shadow_idx_ts.sql
T
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
318 B
SQL

-- 154_analyze_events_shadow_idx_ts.sql
-- PR-A: shadow_would_route_to 기반 조회 인덱스 (migration 153 분할).
-- shadow 기간 대시보드/분석 쿼리용 partial index.
CREATE INDEX IF NOT EXISTS idx_analyze_events_shadow_ts
ON analyze_events (created_at)
WHERE shadow_would_route_to IS NOT NULL;