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:
Accusys
2026-10-04 22:59:34 +08:00
parent c77d3b6766
commit 3ab24e08f1
3 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -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
+5 -5
View File
@@ -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 '{}';
+1 -1
View File
@@ -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;