Files
descrybe/apps/api/sql/schema/024_ai_prompts.sql
T
greeneclipse 8580c996c3 Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
2026-08-09 22:47:43 +02:00

23 lines
907 B
SQL

-- +goose Up
-- Per-company editable AI prompt templates (system + user) with {{variable}} placeholders.
-- Empty templates fall back to built-in defaults in apps/api/internal/aiprompts.
CREATE TABLE ai_prompt_templates (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
company_id UUID NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
prompt_key TEXT NOT NULL
CHECK (prompt_key IN ('product_enhance', 'seo_meta', 'campaign_email')),
system_template TEXT NOT NULL DEFAULT '',
user_template TEXT NOT NULL DEFAULT '',
is_enabled BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
UNIQUE (company_id, prompt_key)
);
CREATE INDEX ai_prompt_templates_company_idx ON ai_prompt_templates (company_id);
-- +goose Down
DROP INDEX IF EXISTS ai_prompt_templates_company_idx;
DROP TABLE IF EXISTS ai_prompt_templates;