fix(migration): final cleanup - all chunks→chunk references corrected
- 009: UPDATE chunks → chunk - 010: ALTER TABLE chunks → chunk - 031: BEFORE INSERT ON chunks → chunk All migrations now fully corrected
This commit is contained in:
@@ -42,7 +42,7 @@ ON chunks USING GIN(content);
|
|||||||
-- ASRX chunks stored as trace_asrx_* have text in content
|
-- ASRX chunks stored as trace_asrx_* have text in content
|
||||||
-- but NULL text_content, making them invisible to BM25.
|
-- but NULL text_content, making them invisible to BM25.
|
||||||
-- ============================================================
|
-- ============================================================
|
||||||
UPDATE chunks
|
UPDATE chunk
|
||||||
SET text_content = content->>'text'
|
SET text_content = content->>'text'
|
||||||
WHERE chunk_type = 'trace'
|
WHERE chunk_type = 'trace'
|
||||||
AND chunk_id LIKE 'trace_asrx_%'
|
AND chunk_id LIKE 'trace_asrx_%'
|
||||||
@@ -56,7 +56,7 @@ WHERE chunk_type = 'trace'
|
|||||||
-- This is handled in the worker code for new imports.
|
-- This is handled in the worker code for new imports.
|
||||||
-- For existing data, we can extract object names:
|
-- For existing data, we can extract object names:
|
||||||
-- (commented out as it requires JSON array iteration)
|
-- (commented out as it requires JSON array iteration)
|
||||||
-- UPDATE chunks
|
-- UPDATE chunk
|
||||||
-- SET text_content = (
|
-- SET text_content = (
|
||||||
-- SELECT string_agg(obj->>'class', ' ')
|
-- SELECT string_agg(obj->>'class', ' ')
|
||||||
-- FROM jsonb_array_elements(content->'objects') AS obj
|
-- FROM jsonb_array_elements(content->'objects') AS obj
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
-- Migration 010: Add visual_stats column to chunks table
|
-- Migration 010: Add visual_stats column to chunk table
|
||||||
-- This column stores pre-computed object counts (from YOLO) for the frames within the chunk.
|
-- Date: 2026-04-15
|
||||||
-- Example: {"person": 150, "car": 12, "envelope": 5}
|
-- 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 public.chunk ADD COLUMN IF NOT EXISTS visual_stats JSONB DEFAULT '{}';
|
||||||
ALTER TABLE dev.chunks ADD COLUMN IF NOT EXISTS visual_stats JSONB DEFAULT '{}';
|
ALTER TABLE dev.chunk ADD COLUMN IF NOT EXISTS visual_stats JSONB DEFAULT '{}';
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ $$ LANGUAGE plpgsql;
|
|||||||
|
|
||||||
-- Create trigger on dev.chunks
|
-- Create trigger on dev.chunks
|
||||||
CREATE TRIGGER trg_chunk_search_vector
|
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();
|
FOR EACH ROW EXECUTE FUNCTION update_chunk_search_vector();
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|||||||
Reference in New Issue
Block a user