alter table is_training_material
add column `is_comment` int(2) DEFAULT '0' COMMENT '是否评论：0-否，1-是' AFTER `is_show`,
add column `introduction` varchar(5000) DEFAULT NULL COMMENT '简介';

CREATE TABLE `is_training_user_view_time_day` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL COMMENT '用户id',
  `create_time` datetime DEFAULT NULL COMMENT '学习日期',
  `view_time` int(11) DEFAULT NULL COMMENT '学习时长：秒',
  `enterprise_id` int(11) DEFAULT NULL COMMENT '企业id',
  `learn_type` int(2) DEFAULT NULL COMMENT '来源：0-素材，1-课程，2-学习项目，3-岗位认证，4-培训计划',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `enterprise_id` (`enterprise_id`) USING BTREE,
  KEY `create_time` (`user_id`,`create_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

alter table is_training_material_comment
add column `type` int(2) DEFAULT '1' COMMENT '类型：1-素材 2-课程' AFTER `id`,
add column `forwards` int(8) DEFAULT '0' COMMENT '转发次数' AFTER `is_collect`,
add column `enterprise_id` int(11) DEFAULT NULL COMMENT '企业id' AFTER `forwards`,
add column `create_time` datetime DEFAULT NULL COMMENT '创建时间' AFTER `enterprise_id`;

CREATE TABLE `is_training_resource` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `object_id` int(11) DEFAULT '0' COMMENT '素材课程id',
  `show_name` varchar(100) DEFAULT '' COMMENT '标题名称',
  `file_type` int(2) DEFAULT '0' COMMENT '文件类型:1-文档 2-图片 3-视频 4-音频 5-压缩文件 6-富文本 7-商品 8-课程',
  `type_id` int(11) DEFAULT '0' COMMENT '类型id',
  `cover_url` varchar(255) DEFAULT '' COMMENT '封面url',
  `cover_type` int(2) DEFAULT '1' COMMENT '封面类型 1系统 2自定义 3类型',
  `path` varchar(1000) DEFAULT '' COMMENT '存储路径',
  `is_using` int(2) DEFAULT '1' COMMENT '启用状态：0-下架，1-上架，2-转码中',
  `is_show` int(2) DEFAULT '1' COMMENT 'app是否显示：0-隐藏，1-显示',
  `is_download` int(2) DEFAULT '0' COMMENT 'app是否能下载：1-是',
  `version` int(11) DEFAULT '1' COMMENT '版本',
  `downloads` int(5) DEFAULT '0' COMMENT '下载次数',
  `read_type` int(2) NOT NULL DEFAULT '1' COMMENT '查看类型 1 跟随分类 2 跟随分类&单独设置 0 未设置',
  `download_type` int(2) DEFAULT '1' COMMENT '下载类型 1 跟随分类 2 跟随分类&单独设置 0 未设置',
  `shareable` int(2) NOT NULL DEFAULT '1' COMMENT '允许分享 1 允许 0 不允许',
  `is_visitor_share` int(2) NOT NULL DEFAULT '0' COMMENT '游客分享 1 允许 0 不允许',
  `is_comment` int(2) DEFAULT '0' COMMENT '是否评论：0-否，1-是',
  `introduction` varchar(5000) DEFAULT NULL COMMENT '简介',
  `is_del` int(2) DEFAULT '0' COMMENT '是否删除：1-是',
  `enterprise_id` int(11) DEFAULT '0' COMMENT '企业id',
  `creater` int(11) DEFAULT '0' COMMENT '创建人id',
  `create_time` datetime DEFAULT null COMMENT '创建时间',
  `updater` int(11) DEFAULT '0' COMMENT '修改人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `object_id` (`object_id`) USING BTREE,
  KEY `type_id` (`type_id`) USING BTREE,
  KEY `enterprise_id` (`enterprise_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COMMENT='素材课程表';

alter table is_training_material_attach
add column `type` int(2) DEFAULT '1' COMMENT '类型：1-素材 2-课程' AFTER `id`,
add column `is_del` int(2) DEFAULT '0' COMMENT '是否删除：1-是',
modify column `material_id` int(11) NULL COMMENT '素材课程id';

alter table is_training_material_lecturer
add column `type` int(2) DEFAULT '1' COMMENT '类型：1-素材 2-课程' AFTER `id`,
modify column `material_id` int(11) NULL COMMENT '素材课程id';

alter table is_training
add column `is_del` int(2) DEFAULT '0' COMMENT '是否删除：1-是',
add column `is_visitor_share` int(2) NOT NULL DEFAULT '0' COMMENT '游客分享 1 允许 0 不允许' AFTER `is_share`,
add column `cover_type` int(2) DEFAULT '1' COMMENT '封面类型 1系统 2自定义 3类型' AFTER `path`,
add column `read_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '查看类型 1 跟随分类 2 跟随分类&单独设置 0 未设置',
add column `version` int(11) DEFAULT '1' COMMENT '素材版本';

alter table is_training_chapter
add column `is_del` int(2) DEFAULT '0' COMMENT '是否删除：1-是';

alter table is_training_chapter_attach
add column `is_del` int(2) DEFAULT '0' COMMENT '是否删除：1-是';

ALTER TABLE `is_training`
ADD COLUMN `is_show`  int(2) NULL COMMENT '是否显示：0-隐藏，1-显示' AFTER `is_del`;
