27 lines
1.7 KiB
SQL
27 lines
1.7 KiB
SQL
-- +goose Up
|
||
CREATE TABLE IF NOT EXISTS notification_templates (
|
||
id BIGSERIAL PRIMARY KEY,
|
||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||
name VARCHAR(128) NOT NULL,
|
||
type VARCHAR(32) NOT NULL,
|
||
title VARCHAR(255) NOT NULL,
|
||
content TEXT NOT NULL,
|
||
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||
);
|
||
|
||
COMMENT ON TABLE notification_templates IS '通知模板:用于超管/运营预置通知内容,便于批量触达与统一管理。';
|
||
COMMENT ON COLUMN notification_templates.id IS '模板主键ID,用于后台检索与引用。';
|
||
COMMENT ON COLUMN notification_templates.tenant_id IS '归属租户ID(0 表示平台级模板);用于限制模板适用范围。';
|
||
COMMENT ON COLUMN notification_templates.name IS '模板名称,用于后台识别用途(如“提现提醒”“内容审核通过”),不直接下发给用户。';
|
||
COMMENT ON COLUMN notification_templates.type IS '通知类型(system/order/audit/interaction),需与前端枚举一致,用于分类与筛选。';
|
||
COMMENT ON COLUMN notification_templates.title IS '通知标题,直接展示给用户的标题文本。';
|
||
COMMENT ON COLUMN notification_templates.content IS '通知内容,直接展示给用户的正文,可包含简要说明与行动提示。';
|
||
COMMENT ON COLUMN notification_templates.is_active IS '是否启用;禁用模板不可用于发送,便于临时下架或停用。';
|
||
COMMENT ON COLUMN notification_templates.created_at IS '创建时间,按时间排序与审计使用。';
|
||
COMMENT ON COLUMN notification_templates.updated_at IS '更新时间,记录最近一次编辑时间。';
|
||
|
||
-- +goose Down
|
||
DROP TABLE IF EXISTS notification_templates;
|