mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-27 05:14:16 +03:00
4ca6c667da
* feat: add prompt_id field to brain * feat(Prompt controller): update prompt routes * feat: remove unused private prompts * refactor: add BrainEntity and repo and service * tests: partially type main Repository * feat: add PromptStatusEnum enum * feat: change delete prompt repository return type
20 lines
573 B
PL/PgSQL
20 lines
573 B
PL/PgSQL
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;
|