refactor: add table primitive and migrations by date; feat: add mcp connectors

This commit is contained in:
willchen96 2026-06-15 17:34:58 +08:00
parent 01dfcfe0d4
commit 9a1277ba99
99 changed files with 9344 additions and 2320 deletions

View file

@ -0,0 +1,27 @@
-- Migration date: 2026-06-02
-- Migration: remove legacy document-level filename.
--
-- Before dropping the old column, copy any remaining legacy names onto
-- version rows that do not yet have their own filename/display value.
-- A later migration renames document_versions.display_name to filename.
DO $$
BEGIN
IF EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'documents'
AND column_name = 'filename'
) THEN
UPDATE public.document_versions dv
SET display_name = d.filename
FROM public.documents d
WHERE dv.document_id = d.id
AND (dv.display_name IS NULL OR btrim(dv.display_name) = '');
ALTER TABLE public.documents
DROP COLUMN filename;
END IF;
END $$;