mirror of
https://github.com/willchen96/mike.git
synced 2026-06-20 21:18:07 +02:00
refactor: add table primitive and migrations by date; feat: add mcp connectors
This commit is contained in:
parent
01dfcfe0d4
commit
9a1277ba99
99 changed files with 9344 additions and 2320 deletions
32
backend/migrations/20260419_tabular_chat_jsonb.sql
Normal file
32
backend/migrations/20260419_tabular_chat_jsonb.sql
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
-- Migration date: 2026-04-19
|
||||
|
||||
-- Migration: Convert tabular_review_chat_messages.content from TEXT to JSONB
|
||||
-- and add annotations JSONB column.
|
||||
--
|
||||
-- User messages: content TEXT → JSON string (e.g. "hello" → '"hello"')
|
||||
-- Assistant messages: content TEXT → events array (e.g. "answer" → '[{"type":"content","text":"answer"}]')
|
||||
--
|
||||
-- Only convert while content is still TEXT. Re-running over jsonb content would
|
||||
-- double-wrap assistant events, so the type check makes this safe to re-run.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF (
|
||||
SELECT data_type
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name = 'tabular_review_chat_messages'
|
||||
AND column_name = 'content'
|
||||
) = 'text' THEN
|
||||
ALTER TABLE tabular_review_chat_messages
|
||||
ALTER COLUMN content TYPE jsonb
|
||||
USING CASE
|
||||
WHEN role = 'user'
|
||||
THEN to_jsonb(content)
|
||||
ELSE
|
||||
jsonb_build_array(jsonb_build_object('type', 'content', 'text', content))
|
||||
END;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
ALTER TABLE tabular_review_chat_messages
|
||||
ADD COLUMN IF NOT EXISTS annotations jsonb;
|
||||
Loading…
Add table
Add a link
Reference in a new issue