mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-16 01:55:15 +03:00
20 lines
573 B
MySQL
20 lines
573 B
MySQL
|
BEGIN;
|
||
|
|
||
|
-- Check if prompt_id column exists
|
||
|
DO $$
|
||
|
BEGIN
|
||
|
IF NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'brains' AND column_name = 'prompt_id') THEN
|
||
|
-- Add prompt_id column and reference the table prompts' id column
|
||
|
ALTER TABLE brains ADD COLUMN prompt_id UUID REFERENCES prompts(id);
|
||
|
END IF;
|
||
|
END $$;
|
||
|
|
||
|
-- Update migrations table
|
||
|
INSERT INTO migrations (name)
|
||
|
SELECT '20230802120700_add_prompt_id_to_brain'
|
||
|
WHERE NOT EXISTS (
|
||
|
SELECT 1 FROM migrations WHERE name = '20230802120700_add_prompt_id_to_brain'
|
||
|
);
|
||
|
|
||
|
COMMIT;
|