Files

15 lines
759 B
SQL
Raw Permalink Normal View History

2026-11-17 14:25:08 +00:00
-- 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);