gxb_study.sql 5.28 KB
/*
 Navicat Premium Data Transfer

 Source Server         : 154
 Source Server Type    : MySQL
 Source Server Version : 50628
 Source Host           : 192.168.30.154
 Source Database       : gxb_study

 Target Server Type    : MySQL
 Target Server Version : 50628
 File Encoding         : utf-8

 Date: 08/24/2017 10:44:13 AM
*/

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `learn_log`
-- ----------------------------
DROP TABLE IF EXISTS `learn_log`;
CREATE TABLE `learn_log` (
  `learn_log_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL COMMENT '用户id',
  `tenant_id` int(11) DEFAULT NULL COMMENT '租户id',
  `course_wrapper_id` int(11) DEFAULT NULL COMMENT '课程id',
  `class_id` int(11) DEFAULT NULL COMMENT '班次id',
  `unit_id` int(11) DEFAULT NULL COMMENT '章节id',
  `context_id` int(11) DEFAULT NULL COMMENT 'chapter_id',
  `context_type` varchar(255) DEFAULT NULL COMMENT 'chapter',
  `redirect_uri` varchar(1000) DEFAULT NULL COMMENT '最后学习的url',
  `school_id` int(11) DEFAULT NULL COMMENT '学校id',
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`learn_log_id`),
  KEY `index_user_id` (`user_id`),
  KEY `index_class_id` (`class_id`)
) ENGINE=InnoDB AUTO_INCREMENT=195238 DEFAULT CHARSET=utf8 COMMENT='学生最后学习记录表';


-- ----------------------------
--  Table structure for `learn_log_history`
-- ----------------------------
DROP TABLE IF EXISTS `learn_log_history`;
CREATE TABLE `learn_log_history` (
  `learn_log_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `tenant_id` int(11) DEFAULT NULL,
  `course_wrapper_id` int(11) DEFAULT NULL,
  `class_id` int(11) DEFAULT NULL,
  `unit_id` int(11) DEFAULT NULL,
  `context_id` int(11) DEFAULT NULL,
  `context_type` varchar(255) DEFAULT NULL,
  `redirect_uri` varchar(1000) DEFAULT NULL,
  `school_id` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`learn_log_id`),
  KEY `index_user_id` (`user_id`),
  KEY `index_class_id` (`class_id`)
) ENGINE=InnoDB AUTO_INCREMENT=194702 DEFAULT CHARSET=utf8 COMMENT='学生最后学习记录表(历史汇总表)';

-- ----------------------------
--  Table structure for `learn_record`
-- ----------------------------
DROP TABLE IF EXISTS `learn_record`;
CREATE TABLE `learn_record` (
  `learn_record_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL COMMENT '用户id',
  `class_id` int(11) DEFAULT NULL COMMENT '班次id',
  `chapter_id` int(11) DEFAULT NULL,
  `video_id` int(11) DEFAULT NULL COMMENT '视频id',
  `video_length` int(11) DEFAULT NULL COMMENT '视频时长',
  `cur_view_time` int(11) DEFAULT NULL COMMENT '当前观看时长',
  `max_view_time` int(11) DEFAULT NULL COMMENT '最大观看时长',
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `learn_status` int(11) DEFAULT NULL COMMENT '是否观看完成 1未完成 2完成',
  PRIMARY KEY (`learn_record_id`),
  UNIQUE KEY `class_chapter_user_unque_index` (`class_id`,`chapter_id`,`user_id`) USING BTREE,
  KEY `class_index` (`class_id`),
  KEY `chapter_index` (`chapter_id`),
  KEY `user_index` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13152064 DEFAULT CHARSET=utf8 COMMENT='观看视频时长表';



-- ----------------------------
--  Table structure for `learn_record_history`
-- ----------------------------
DROP TABLE IF EXISTS `learn_record_history`;
CREATE TABLE `learn_record_history` (
  `learn_record_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `class_id` int(11) DEFAULT NULL,
  `chapter_id` int(11) DEFAULT NULL,
  `video_id` int(11) DEFAULT NULL,
  `video_length` int(11) DEFAULT NULL,
  `cur_view_time` int(11) DEFAULT NULL,
  `max_view_time` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `learn_status` int(11) DEFAULT NULL,
  PRIMARY KEY (`learn_record_id`),
  UNIQUE KEY `class_chapter_user_unque_index` (`class_id`,`chapter_id`,`user_id`) USING BTREE,
  KEY `class_index` (`class_id`),
  KEY `chapter_index` (`chapter_id`),
  KEY `user_index` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=15125530 DEFAULT CHARSET=utf8 COMMENT='学生观看视频时长(历史汇总表)';

-- ----------------------------
--  Table structure for `programming_record`
-- ----------------------------
DROP TABLE IF EXISTS `programming_record`;
CREATE TABLE `programming_record` (
  `programming_record_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `class_id` int(11) NOT NULL DEFAULT '0',
  `chapter_id` int(11) DEFAULT NULL,
  `programming_id` int(11) DEFAULT NULL,
  `programming_length` int(11) DEFAULT NULL,
  `cur_view_time` int(11) DEFAULT NULL,
  `max_view_time` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `learn_status` int(11) DEFAULT NULL,
  PRIMARY KEY (`programming_record_id`,`class_id`),
  UNIQUE KEY `class_chapter_user_unque_index` (`class_id`,`chapter_id`,`user_id`) USING BTREE,
  KEY `class_index` (`class_id`),
  KEY `chapter_index` (`chapter_id`),
  KEY `user_index` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='废弃表'
/*!50100 PARTITION BY HASH (class_id)
PARTITIONS 100 */;

SET FOREIGN_KEY_CHECKS = 1;