/*
SQLyog Community v13.1.6 (64 bit)
MySQL - 5.7.15-log : Database - cps_shelf_372
*********************************************************************
*/

/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`cps_shelf_372` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;

USE `cps_shelf_372`;

/*Table structure for table `book_shelf` */

DROP TABLE IF EXISTS `book_shelf`;

CREATE TABLE `book_shelf` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户id',
  `book_id` bigint(20) unsigned NOT NULL COMMENT '书籍id',
  `insert_type` tinyint(3) unsigned NOT NULL COMMENT '加入书架的方式。1、用户注册时加入的系统推荐书籍。2、阅读到第10章自动加入书架。3、用户手动加入书架。',
  `chapter_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '加入书架时阅读章节id',
  `idx` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '加入书架时阅读章节序号。',
  `flag` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否生效。1、生效。0、已删除。',
  `createtime` int(10) unsigned NOT NULL COMMENT '创建时间',
  `updatetime` int(10) unsigned NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  KEY `book_shelf_user_id_book_id_insert_type_index` (`user_id`,`book_id`,`insert_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户书架';

/*Data for the table `book_shelf` */

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
