Files
hyungi_document_server/migrations/215_md_frontmatter_gin_idx.sql
Hyungi Ahn fe26aadb27 fix(canonical): split Phase 1A migrations into single-statement files (211-219)
asyncpg exec_driver_sql 의 prepared statement 제약상 multi-statement 파일은
"cannot insert multiple commands into a prepared statement" 에러로 적용 실패.
규칙: 한 migration = 한 statement (다중 ADD COLUMN 절은 단일 statement 라 허용,
인덱스/CHECK/CREATE TABLE 은 별도 파일).

이전 cee01af 의 211_md_canonical_layer.sql (6 statements) + 212_document_lineage.sql
(3 statements) 을 9 파일로 분할:
  211 ALTER TABLE documents ADD COLUMN x13
  212 ADD CONSTRAINT documents_md_draft_status_only_ai
  213 idx_documents_md_status_pending
  214 idx_documents_content_origin
  215 idx_documents_md_frontmatter_gin (선제 인덱스)
  216 idx_documents_md_draft_status
  217 CREATE TABLE document_lineage
  218 idx_document_lineage_source
  219 idx_document_lineage_derived

dry-run 재검증: 13 cols / 28 doc idx / 4 lineage idx PASS.
계획 변경 없음 — schema 결과 동일, 적용 단위만 분할.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 01:57:11 +00:00

8 lines
387 B
SQL

-- 215_md_frontmatter_gin_idx.sql
-- Phase 1A: frontmatter JSONB 기반 검색 (project_code, doc_type 등) GIN.
-- Phase 1A 시점엔 모든 행 '{}' 이므로 즉시 활용 X. Phase 1B 이후 frontmatter 필터링용.
-- INSERT latency 문제 발생 시 1순위 rollback 대상.
CREATE INDEX IF NOT EXISTS idx_documents_md_frontmatter_gin
ON documents USING GIN (md_frontmatter);