Files
hyungi_document_server/migrations/117_queue_active_unique.sql
Hyungi Ahn 7c78c09046 fix(queue): migration을 단일 statement 파일 3개로 분리
asyncpg prepare가 다중 statement 불가. 117(stale 정리) → 118(constraint 제거)
→ 119(partial unique index 생성) 순차 실행.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 08:40:19 +09:00

9 lines
314 B
SQL

-- stale duplicate 삭제 (processing 10분+ 방치 + 같은 doc/stage에 pending 존재)
DELETE FROM processing_queue a
USING processing_queue b
WHERE a.document_id = b.document_id
AND a.stage = b.stage
AND a.status = 'processing'
AND a.started_at < NOW() - INTERVAL '10 minutes'
AND b.status = 'pending'