19 lines
1013 B
SQL
19 lines
1013 B
SQL
-- One model for all analyses (natal, synastry, forecast) and a separate one
|
|||
|
|
-- for answering questions; the short summary keeps its own.
|
||
|
|
ALTER TABLE model_settings DROP CONSTRAINT model_settings_kind_check;
|
||
|
|
INSERT INTO model_settings (kind, model, updated_by, updated_at)
|
||
|
|
SELECT 'analysis', model, updated_by, updated_at FROM model_settings
|
||
|
|
WHERE kind IN ('natal', 'synastry', 'forecast') ORDER BY updated_at DESC LIMIT 1;
|
||
|
|
DELETE FROM model_settings WHERE kind IN ('natal', 'synastry', 'forecast');
|
||
|
|
ALTER TABLE model_settings ADD CONSTRAINT model_settings_kind_check
|
||
|
|
CHECK (kind IN ('summary', 'analysis', 'question'));
|
||
|
|
|
||
|
|
-- When the chosen model fails, the default model takes over (`on_fallback`).
|
||
|
|
-- NULL: the chosen model is the default, there is nothing to fall back to.
|
||
|
|
ALTER TABLE analyses
|
||
|
|
ADD COLUMN fallback_model text,
|
||
|
|
ADD COLUMN on_fallback boolean NOT NULL DEFAULT false;
|
||
|
|
ALTER TABLE questions
|
||
|
|
ADD COLUMN fallback_model text,
|
||
|
|
ADD COLUMN on_fallback boolean NOT NULL DEFAULT false;
|