Files
hyungi_document_server/migrations/280_document_chunks_legacy_backfill.sql
hyungi 72190cf90a feat(search): add document_chunks page/source columns + unique idx
migrations 279-281: page_start/end + source_type/chunker_version/source_hash/chunk_content_hash, legacy backfill (30,952 rows), unique (doc_id,source_type,chunker_version,chunk_index). PR-DocSrv-LargeDoc-Split-Markdown-1 commit 1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 07:01:34 +00:00

9 lines
530 B
SQL

-- 기존 row 안전 backfill = legacy/legacy (과분류 X; Phase 3A 가 정확 source_type 으로 재생성/정리).
-- page_start/end 는 기존 단일 page 컬럼으로 (page NULL 이면 NULL 유지).
UPDATE document_chunks SET
source_type = COALESCE(source_type, 'legacy'),
chunker_version = COALESCE(chunker_version, 'legacy'),
page_start = COALESCE(page_start, page),
page_end = COALESCE(page_end, page)
WHERE source_type IS NULL OR chunker_version IS NULL OR page_start IS NULL OR page_end IS NULL;