15 lines
759 B
SQL
15 lines
759 B
SQL
-- Admin-edited system prompts of the analyses. The newest row of a
|
|||
|
|
-- (kind, language) is in force; system NULL means the built-in default.
|
||
|
|
-- An analysis records the revision it was written with in prompt_version
|
||
|
|
-- ("v2-r<id>"), so the worker uses exactly that text.
|
||
|
|
CREATE TABLE prompt_revisions (
|
||
|
|
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||
|
|
kind text NOT NULL CHECK (kind IN ('summary', 'natal', 'synastry')),
|
||
|
|
language text NOT NULL,
|
||
|
|
system text CHECK (system IS NULL OR length(system) BETWEEN 1 AND 50000),
|
||
|
|
created_by uuid REFERENCES users ON DELETE SET NULL,
|
||
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE INDEX prompt_revisions_current ON prompt_revisions (kind, language, id DESC);
|