-- 订阅产品信息表(custody_subscribe_fund_info)
DROP TABLE IF EXISTS `custody_subscribe_fund_info`;
CREATE TABLE `custody_subscribe_fund_info`  (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `admin` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '管理人',
  `trust_no` int(2) NULL DEFAULT NULL COMMENT '托管人',
  `subscribe_fund_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订阅的产品代码',
  `account_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '通知的账户类型;ZJ001-托管户;ZJ002-募集户',
  `reminder_type` int(1) NULL DEFAULT NULL COMMENT '提醒类型: 0:变动提醒;1:超限提醒(余额值);',
  `high_limit_value` decimal(20, 2) NULL DEFAULT NULL COMMENT '上限值(万元)',
  `low_limit_value` decimal(20, 2) NULL DEFAULT NULL COMMENT '下限值(万元)',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `is_deleted` int(1) NULL DEFAULT 0 COMMENT '是否删除(有效|0,无效|1)',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `unique_key`(`subscribe_fund_code`, `account_type`) USING BTREE COMMENT '唯一索引'
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订阅产品信息表(custody_subscribe_fund_info)' ROW_FORMAT = Dynamic;

-- 订阅关联表(custody_subscribe_fund_notifier_info)
DROP TABLE IF EXISTS `custody_subscribe_fund_notifier_info`;
CREATE TABLE `custody_subscribe_fund_notifier_info`  (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `fund_id` int(20) NOT NULL COMMENT '订阅基金产品代码ID',
  `notifier_id` int(20) NOT NULL COMMENT '通知人ID',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `is_deleted` int(1) NULL DEFAULT 0 COMMENT '是否删除(有效|0,无效|1)',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订阅关联表(custody_subscribe_fund_notifier_info)' ROW_FORMAT = Dynamic;

-- 订阅人信息表(custody_notifier_info)
DROP TABLE IF EXISTS `custody_notifier_info`;
CREATE TABLE `custody_notifier_info`  (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `notifier` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '通知人',
  `email_address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮箱', `mobile_no` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号',
  `notice_method` int(1) NULL DEFAULT NULL COMMENT '通知方式: 0:邮件、短信都订阅; 1:订阅邮件； 2: 订阅短信; 3:都不订阅',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `is_deleted` int(1) NULL DEFAULT 0 COMMENT '是否删除(有效|0,无效|1)',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `unique_key`(`notifier`, `email_address`, `mobile_no`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订阅人信息表(custody_notifier_info)' ROW_FORMAT = Dynamic;