-- 024_ocr_words.down.sql
-- Rollback documentation for 024_ocr_words.sql.
-- Documentation only — archivdms has no migration runner; run manually via
-- psql after deploying a binary whose initSchema no longer creates the table.
--
-- PRECONDITION: Store.initOCRWordsSchema must be removed from
-- Store.initSchema (internal/storage/documents.go) and every caller of
-- ReplaceOCRWords / the word-box read path must be gone first — otherwise
-- the next process start recreates the table.
--
-- DATA LOSS: ocr_words is a DERIVED index over each document's OCR run, not
-- an original record. Dropping it loses no GoBD-relevant data; the word boxes
-- are fully regenerable by re-running OCR
-- (`archivdms documents reprocess-all`). Only the highlight/overlay feature
-- degrades until then.
--
-- WORM: no archived file in store/ is touched; the FK to documents is only
-- consumed here (ON DELETE CASCADE), never the other way round, so dropping
-- this table cannot cascade into documents.

BEGIN;

DROP INDEX IF EXISTS idx_ocr_words_word_text;
DROP INDEX IF EXISTS idx_ocr_words_document;
DROP TABLE IF EXISTS ocr_words;

COMMIT;
