-- ----------------------------
-- 课程学习学习日志表
-- ----------------------------
drop table if exists `train_exam`.`ex_student_study`;
CREATE TABLE `train_exam`.`ex_student_study`  (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键' ,
`phase_id` bigint(20) NOT NULL COMMENT '课时批次id',
`course_id` bigint(20) NOT NULL COMMENT '课程id',
`chapter_id` bigint(20) NOT NULL COMMENT '章节id',
`period_id` bigint(20) NOT NULL COMMENT '课时id',
`student_id` bigint(20) NOT NULL COMMENT '学员id',
`current_duration` bigint(20) NOT NULL DEFAULT 0 COMMENT '当前学习时长，单位秒',
`current_page` int NOT NULL DEFAULT 0 COMMENT '当前学习页数，单位页',
`progress` decimal(5, 2) NOT NULL DEFAULT 0 COMMENT '进度(百分比)',
`resource_type` varchar(10) NOT NULL  COMMENT '资源类型(PPT,MP4,PDF)',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`create_by` varchar(50) NULL DEFAULT NULL COMMENT '创建人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`update_by` varchar(50) NULL DEFAULT NULL COMMENT '更新人',
`remark` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`version` int NULL DEFAULT 0 COMMENT '乐观锁',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_student_peroid`(`phase_id`, `period_id`, `student_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '课程学习学习日志表' ROW_FORMAT = DYNAMIC;
