feat(ECR-038): GrowthInsights ReportTemplate 只读并 Closed

ReportTemplate catalog (000039) · Loop continuous.
This commit is contained in:
jackyu66git
2026-08-08 03:16:57 +08:00
parent b34b4f281f
commit 5de9a7bbe5
26 changed files with 466 additions and 2 deletions
@@ -0,0 +1,24 @@
-- ECR-038 ReportTemplate (read catalog)
CREATE TABLE IF NOT EXISTS report_templates (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
code varchar(64) NOT NULL UNIQUE,
title varchar(128) NOT NULL,
scene varchar(32) NOT NULL,
active boolean NOT NULL DEFAULT true,
system boolean NOT NULL DEFAULT false,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_report_templates_active ON report_templates(active);
INSERT INTO report_templates(code, title, scene, active, system)
VALUES ('portrait_default', '画像报告模板占位', 'portrait', true, true)
ON CONFLICT (code) DO NOTHING;
INSERT INTO admin_role_permissions(role_id, code)
SELECT r.id, 'admin.growth.read'
FROM admin_roles r
WHERE r.name = 'super_admin'
ON CONFLICT DO NOTHING;