use  tamp_community;

ALTER TABLE tamp_community.file_record ADD `check_status` int(3) NOT NULL DEFAULT '0' COMMENT '审核状态 0：初试化 1：通过 2：不通过 3:需要人工再审';
ALTER TABLE tamp_community.file_record ADD `check_result_log` varchar(500) NOT NULL DEFAULT '' COMMENT '审核结果记录';

CREATE TABLE `notification` (
  `id` bigint(32) NOT NULL COMMENT 'id',
  `notification_id` varchar(64) NOT NULL DEFAULT '' COMMENT '通知主键Id',
  `notified_user_id` varchar(64) NOT NULL DEFAULT '' COMMENT '被通知的用户id',
  `message_type` varchar(64) NOT NULL DEFAULT '' COMMENT '1:转发 2：点赞 3：评论 4：关注',
  `target_id` varchar(64) NOT NULL DEFAULT '' COMMENT '目标id，类型是转发、点赞、评论时为themeId，关注则为user_id',
  `content` varchar(600) NOT NULL DEFAULT '' COMMENT '评论:评论内容  转发：topicId+内容  点赞：人数+最近3个用户',
  `operator_id` varchar(64) NOT NULL DEFAULT '' COMMENT '操作者id',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `delete_tag` int(3) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `idx_user_type_time` (`notified_user_id`,`update_time`,`message_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息通知记录';

CREATE TABLE `user_poster_attachement` (
                                           `id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
                                           `user_id` varchar(64) NOT NULL DEFAULT '' COMMENT '用户Id',
                                           `type` varchar(16) NOT NULL DEFAULT '' COMMENT '附件类型',
                                           `target_id` varchar(64) NOT NULL DEFAULT '' COMMENT '附件Id',
                                           `sub_type` varchar(64) NOT NULL DEFAULT '' COMMENT '子类型，article-source,fund-type',
                                           `course_packageId` varchar(64) NOT NULL DEFAULT '' COMMENT '课程包',
                                           `product_is_recommend` int(4) NOT NULL DEFAULT '0' COMMENT '是否推荐',
                                           `product_recommend` varchar(1000) NOT NULL DEFAULT '' COMMENT '推荐语',
                                           `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                           `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                           `delete_tag` int(3) NOT NULL DEFAULT '0',
                                           PRIMARY KEY (`id`) USING BTREE,
                                           KEY `idx_type_id` (`tpye`,`target_id`,`delete_tag`) USING BTREE,
                                           KEY `idx_user_type_id` (`user_id`,`type`,`target_id`,`delete_tag`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作室海报附件表';

CREATE TABLE `theme_text_filter` (
                                `id` bigint(32) NOT NULL COMMENT 'id',
                                `theme_id` varchar(64) NOT NULL DEFAULT '' COMMENT '主题Id',
                                `partition` varchar(64) NOT NULL DEFAULT '' COMMENT '分块',
                                `partition_hash` varchar(64) NOT NULL DEFAULT '' COMMENT '分块hash',
                                `partition_num` int NOT NULL DEFAULT 0 COMMENT '分块号',
                                `total_parts` int NOT NULL DEFAULT 0 COMMENT '分块总数',
                                `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                `delete_tag` int(3) NOT NULL DEFAULT '0',
                                PRIMARY KEY (`id`),
                                KEY `idx_hash_theme_num` (`partition_hash`,`theme_id`,`partition_num`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='主题文字查重表';