Files
GovAI/server/migrations/000008_document_templates.up.sql
2026-06-15 23:48:37 +08:00

20 lines
807 B
SQL

-- 公文模板表
CREATE TABLE IF NOT EXISTS document_templates (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(100) NOT NULL,
doc_type VARCHAR(50) NOT NULL,
description TEXT,
icon VARCHAR(50),
format_standard TEXT NOT NULL DEFAULT '',
fields JSONB NOT NULL DEFAULT '[]',
prompt_template TEXT NOT NULL DEFAULT '',
example_output TEXT,
sort_order INT NOT NULL DEFAULT 0,
is_active BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_document_templates_doc_type ON document_templates(doc_type);
CREATE INDEX idx_document_templates_active ON document_templates(is_active);