diff --git a/migrations/009_data_preservation_indexes.sql b/migrations/009_data_preservation_indexes.sql index 712523b6..8ec931b3 100644 --- a/migrations/009_data_preservation_indexes.sql +++ b/migrations/009_data_preservation_indexes.sql @@ -42,7 +42,7 @@ ON chunks USING GIN(content); -- ASRX chunks stored as trace_asrx_* have text in content -- but NULL text_content, making them invisible to BM25. -- ============================================================ -UPDATE chunks +UPDATE chunk SET text_content = content->>'text' WHERE chunk_type = 'trace' AND chunk_id LIKE 'trace_asrx_%' @@ -56,7 +56,7 @@ WHERE chunk_type = 'trace' -- This is handled in the worker code for new imports. -- For existing data, we can extract object names: -- (commented out as it requires JSON array iteration) --- UPDATE chunks +-- UPDATE chunk -- SET text_content = ( -- SELECT string_agg(obj->>'class', ' ') -- FROM jsonb_array_elements(content->'objects') AS obj diff --git a/migrations/010_add_chunk_visual_stats.sql b/migrations/010_add_chunk_visual_stats.sql index 9d5a9a30..81df6cee 100644 --- a/migrations/010_add_chunk_visual_stats.sql +++ b/migrations/010_add_chunk_visual_stats.sql @@ -1,6 +1,6 @@ --- Migration 010: Add visual_stats column to chunks table --- This column stores pre-computed object counts (from YOLO) for the frames within the chunk. --- Example: {"person": 150, "car": 12, "envelope": 5} +-- Migration 010: Add visual_stats column to chunk table +-- Date: 2026-04-15 +-- Description: Add visual_stats JSONB column to store frame-level analysis results -ALTER TABLE public.chunks ADD COLUMN IF NOT EXISTS visual_stats JSONB DEFAULT '{}'; -ALTER TABLE dev.chunks ADD COLUMN IF NOT EXISTS visual_stats JSONB DEFAULT '{}'; +ALTER TABLE public.chunk ADD COLUMN IF NOT EXISTS visual_stats JSONB DEFAULT '{}'; +ALTER TABLE dev.chunk ADD COLUMN IF NOT EXISTS visual_stats JSONB DEFAULT '{}'; diff --git a/migrations/031_add_chunk_search_trigger.sql b/migrations/031_add_chunk_search_trigger.sql index 08a2830b..720fcc6a 100644 --- a/migrations/031_add_chunk_search_trigger.sql +++ b/migrations/031_add_chunk_search_trigger.sql @@ -19,7 +19,7 @@ $$ LANGUAGE plpgsql; -- Create trigger on dev.chunks CREATE TRIGGER trg_chunk_search_vector - BEFORE INSERT OR UPDATE ON dev.chunks + BEFORE INSERT OR UPDATE ON dev.chunk FOR EACH ROW EXECUTE FUNCTION update_chunk_search_vector(); COMMIT;