-- ----------------------------
--  Data for `dt_message_send_register`
-- ----------------------------
CREATE TABLE IF NOT EXISTS "dt_message_send_register" (
"id" varchar(40) NOT NULL COMMENT '主键id',
"code" varchar(40) NOT NULL COMMENT '发送渠道编码',
"name" varchar(40) NOT NULL COMMENT '发送渠道名称',
"access_key" varchar(255) DEFAULT NULL COMMENT 'accessKey',
"access_secret" text COMMENT 'accessSecret',
"extra" text COMMENT '扩展参数',
"clazz" varchar(255) NOT NULL COMMENT '发送消息实现类',
"creator" varchar(32) DEFAULT NULL COMMENT '创建人',
"creation_time" char(14) DEFAULT NULL COMMENT '创建时间',
"modifier" varchar(32) DEFAULT NULL COMMENT '最后修改人',
"modified_time" char(14) DEFAULT NULL COMMENT '最后修改时间',
"valid" tinyint(1) DEFAULT NULL COMMENT '合法标识',
"ts" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '乐观锁',
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB;


-- ----------------------------
--  Data for `dt_message_type`
-- ----------------------------
CREATE TABLE IF NOT EXISTS "dt_message_type" (
"id" varchar(40) NOT NULL COMMENT '主键id',
"type_code" varchar(40) NOT NULL COMMENT '消息类型编码',
"type_name" varchar(40) NOT NULL COMMENT '消息类型名称',
"send_channel" varchar(255) NOT NULL,
"remark" text COMMENT '备注',
"creator" varchar(32) DEFAULT NULL COMMENT '创建人',
"creation_time" char(14) DEFAULT NULL COMMENT '创建时间',
"modifier" varchar(32) DEFAULT NULL COMMENT '最后修改人',
"modified_time" char(14) DEFAULT NULL COMMENT '最后修改时间',
"valid" tinyint(1) DEFAULT NULL COMMENT '合法标识',
"ts" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '乐观锁',
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB;


-- ----------------------------
--  Data for `dt_message`
-- ----------------------------
CREATE TABLE IF NOT EXISTS "dt_message" (
"id" varchar(40) NOT NULL COMMENT '主键id',
"type_id" varchar(40) NOT NULL COMMENT '消息类型',
"user_id" varchar(40) NOT NULL COMMENT '接收用户',
"copy_to_user_id" text COMMENT '抄送用户，多个抄送者可以用逗号分隔，最多100个地址（主要用于邮箱发送）',
"title" varchar(255) NOT NULL,
"content" text NOT NULL,
"business_id" varchar(40) DEFAULT NULL,
"project_id" varchar(40) DEFAULT NULL,
"send_channel" varchar(255) NOT NULL COMMENT '发送渠道',
"read_flag" tinyint(1) DEFAULT NULL COMMENT '已读标示',
"top_flag" tinyint(1) DEFAULT NULL COMMENT '置顶标示',
"attachments" json DEFAULT NULL COMMENT '附件',
"creator" varchar(32) DEFAULT NULL,
"creation_time" char(14) DEFAULT NULL,
"modifier" varchar(32) DEFAULT NULL,
"modified_time" char(14) DEFAULT NULL,
"valid" tinyint(1) DEFAULT NULL,
"ts" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB