/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50519
Source Host           : localhost:3306
Source Database       : bookstore

Target Server Type    : MYSQL
Target Server Version : 50519
File Encoding         : 65001

Date: 2023-09-06 13:21:57
*/


-- ----------------------------
-- Records of access
-- ----------------------------

-- ----------------------------
-- Table structure for `author`
-- ----------------------------
CREATE TABLE `author` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(500) DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `lastupdate` datetime DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `user_reg_id` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_author_user1_idx` (`user_id`),
  CONSTRAINT `fk_author_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of author
-- ----------------------------

-- ----------------------------
-- Table structure for `banners`
-- ----------------------------
CREATE TABLE `banners` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create` datetime DEFAULT NULL,
  `number` int(11) DEFAULT NULL,
  `name` mediumtext,
  `url` longtext,
  `lastupdate` datetime DEFAULT NULL,
  `clicks` int(11) DEFAULT NULL COMMENT 'total clicks\\n',
  `status` varchar(5) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `pages_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_banners_user1_idx` (`user_id`),
  KEY `fk_banners_pages1_idx` (`pages_id`),
  CONSTRAINT `fk_banners_pages1` FOREIGN KEY (`pages_id`) REFERENCES `pages` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_banners_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of banners
-- ----------------------------

-- ----------------------------
-- Table structure for `banner_clicks`
-- ----------------------------
CREATE TABLE `banner_clicks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `count` int(11) DEFAULT NULL,
  `lastupdate` int(11) DEFAULT NULL,
  `banners_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_banner_clicks_banners1_idx` (`banners_id`),
  KEY `fk_banner_clicks_user2_idx` (`user_id`),
  CONSTRAINT `fk_banner_clicks_banners1` FOREIGN KEY (`banners_id`) REFERENCES `banners` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_banner_clicks_user2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of banner_clicks
-- ----------------------------

-- ----------------------------
-- Table structure for `book`
-- ----------------------------
CREATE TABLE `book` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` longtext,
  `description` longtext,
  `book_url` longtext,
  `book_url_name` longtext COMMENT 'book file real name',
  `book_img` longtext,
  `book_sample_url` longtext,
  `book_sample_url_name` longtext COMMENT 'sample file real name',
  `pbacklink` longtext,
  `pbacklink_details` mediumtext,
  `isbn` varchar(100) DEFAULT NULL,
  `publishd_date` varchar(45) DEFAULT NULL,
  `language` varchar(45) DEFAULT NULL,
  `page_count` int(11) DEFAULT NULL,
  `rating` double DEFAULT '0',
  `price` double DEFAULT '0',
  `old_price` double DEFAULT '0',
  `pay_type` varchar(45) DEFAULT NULL,
  `clicks` int(11) DEFAULT '0',
  `created` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `lastupdate` datetime DEFAULT NULL,
  `publisher_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_book_publisher1_idx` (`publisher_id`),
  KEY `fk_book_user1_idx` (`user_id`),
  CONSTRAINT `fk_book_publisher1` FOREIGN KEY (`publisher_id`) REFERENCES `publisher` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_book_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of book
-- ----------------------------

-- ----------------------------
-- Table structure for `book_category`
-- ----------------------------
CREATE TABLE `book_category` (
  `category_id` int(11) NOT NULL,
  `book_id` int(11) NOT NULL,
  PRIMARY KEY (`category_id`,`book_id`),
  KEY `fk_book_category_book1_idx` (`book_id`),
  KEY `fk_book_category_category1_idx` (`category_id`),
  CONSTRAINT `fk_book_category_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_book_category_category1` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of book_category
-- ----------------------------

-- ----------------------------
-- Table structure for `book_clicks`
-- ----------------------------
CREATE TABLE `book_clicks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `count` int(11) DEFAULT NULL,
  `lastupdate` datetime DEFAULT NULL,
  `book_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_book_clicks_book1_idx` (`book_id`),
  KEY `fk_book_clicks_user1_idx` (`user_id`),
  CONSTRAINT `fk_book_clicks_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_book_clicks_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of book_clicks
-- ----------------------------

-- ----------------------------
-- Table structure for `book_genre`
-- ----------------------------
CREATE TABLE `book_genre` (
  `book_id` int(11) NOT NULL,
  `genre_id` int(11) NOT NULL,
  PRIMARY KEY (`book_id`,`genre_id`),
  KEY `fk_book_genre_book1_idx` (`book_id`),
  KEY `fk_book_genre_genre1_idx` (`genre_id`),
  CONSTRAINT `fk_book_genre_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_book_genre_genre1` FOREIGN KEY (`genre_id`) REFERENCES `genre` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of book_genre
-- ----------------------------

-- ----------------------------
-- Table structure for `book_has_author`
-- ----------------------------
CREATE TABLE `book_has_author` (
  `book_id` int(11) NOT NULL,
  `author_id` int(11) NOT NULL,
  PRIMARY KEY (`book_id`,`author_id`),
  KEY `fk_book_has_author_book1_idx` (`book_id`),
  KEY `fk_book_has_author_author1_idx` (`author_id`),
  CONSTRAINT `fk_book_has_author_author1` FOREIGN KEY (`author_id`) REFERENCES `author` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_book_has_author_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of book_has_author
-- ----------------------------

-- ----------------------------
-- Table structure for `cart`
-- ----------------------------
CREATE TABLE `cart` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `created` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_cart_user1_idx` (`user_id`),
  CONSTRAINT `fk_cart_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of cart
-- ----------------------------

-- ----------------------------
-- Table structure for `cart_items`
-- ----------------------------
CREATE TABLE `cart_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `created` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `book_id` int(11) NOT NULL,
  `cart_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_cart_items_cart1_idx` (`cart_id`),
  KEY `fk_cart_items_book1_idx` (`book_id`),
  CONSTRAINT `fk_cart_items_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_cart_items_cart1` FOREIGN KEY (`cart_id`) REFERENCES `cart` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of cart_items
-- ----------------------------

-- ----------------------------
-- Table structure for `category`
-- ----------------------------
CREATE TABLE `category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(500) DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `lastupdate` datetime DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_category_user1_idx` (`user_id`),
  CONSTRAINT `fk_category_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of category
-- ----------------------------
INSERT INTO `category` VALUES ('1', 'Educational ', '1', '2023-09-05 19:27:10', '1');
INSERT INTO `category` VALUES ('2', 'Medical', '1', '2023-09-05 19:27:27', '1');
INSERT INTO `category` VALUES ('3', 'Novels', '1', '2023-09-05 19:27:40', '1');
INSERT INTO `category` VALUES ('4', 'Teacher recommended', '1', '2023-09-05 19:27:53', '1');
INSERT INTO `category` VALUES ('5', '18+', '1', '2023-09-05 19:28:05', '1');

-- ----------------------------
-- Table structure for `discount`
-- ----------------------------
CREATE TABLE `discount` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `value` double DEFAULT NULL COMMENT 'discount from %',
  `status` varchar(5) DEFAULT NULL,
  `discount_reg_id` int(11) NOT NULL,
  `book_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_discounts_discount_reg1_idx` (`discount_reg_id`),
  KEY `fk_discounts_book1_idx` (`book_id`),
  CONSTRAINT `fk_discounts_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_discounts_discount_reg1` FOREIGN KEY (`discount_reg_id`) REFERENCES `discount_reg` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of discount
-- ----------------------------

-- ----------------------------
-- Table structure for `discount_reg`
-- ----------------------------
CREATE TABLE `discount_reg` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `create` datetime DEFAULT NULL,
  `lastupdate` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_discount_reg_user1_idx` (`user_id`),
  CONSTRAINT `fk_discount_reg_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of discount_reg
-- ----------------------------

-- ----------------------------
-- Table structure for `events`
-- ----------------------------
CREATE TABLE `events` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` mediumtext,
  `web_link` longtext,
  `description` longtext,
  `url` longtext,
  `create` datetime DEFAULT NULL,
  `lastupdate` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_events_user1_idx` (`user_id`),
  CONSTRAINT `fk_events_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of events
-- ----------------------------

-- ----------------------------
-- Table structure for `f_a_q`
-- ----------------------------
CREATE TABLE `f_a_q` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `quiz` longtext,
  `answer` longtext,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of f_a_q
-- ----------------------------

-- ----------------------------
-- Table structure for `genre`
-- ----------------------------
CREATE TABLE `genre` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(500) DEFAULT NULL,
  `lastupdate` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_genre_user1_idx` (`user_id`),
  CONSTRAINT `fk_genre_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of genre
-- ----------------------------
INSERT INTO `genre` VALUES ('1', 'Adventure', '2023-09-05 19:28:29', '1', '1');
INSERT INTO `genre` VALUES ('2', 'Sci-fi ', '2023-09-05 19:28:39', '1', '1');
INSERT INTO `genre` VALUES ('3', 'Geography', '2023-09-05 19:28:50', '1', '1');
INSERT INTO `genre` VALUES ('4', 'Paediatric ', '2023-09-05 19:29:01', '1', '1');
INSERT INTO `genre` VALUES ('5', 'Adult', '2023-09-05 19:29:16', '1', '1');

-- ----------------------------
-- Table structure for `home_page`
-- ----------------------------
CREATE TABLE `home_page` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) DEFAULT NULL,
  `type` varchar(45) DEFAULT NULL,
  `order_num` int(11) DEFAULT NULL COMMENT 'order num - there is 5 sections that is 1,2,3,4,5 order num set field',
  `lastlog` datetime DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_home_page_user1_idx` (`user_id`),
  CONSTRAINT `fk_home_page_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of home_page
-- ----------------------------

-- ----------------------------
-- Table structure for `home_page_books`
-- ----------------------------
CREATE TABLE `home_page_books` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `home_page_id` int(11) NOT NULL,
  `book_id` int(11) NOT NULL,
  `status` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_home_page_books_book1_idx` (`book_id`),
  KEY `fk_home_page_books_home_page1_idx` (`home_page_id`),
  CONSTRAINT `fk_home_page_books_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_home_page_books_home_page1` FOREIGN KEY (`home_page_id`) REFERENCES `home_page` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of home_page_books
-- ----------------------------

-- ----------------------------
-- Table structure for `migrations`
-- ----------------------------
CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of migrations
-- ----------------------------

-- ----------------------------
-- Table structure for `pages`
-- ----------------------------
CREATE TABLE `pages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(45) DEFAULT NULL COMMENT 'web or mobile page',
  `name` varchar(45) DEFAULT NULL,
  `link` longtext,
  `status` varchar(5) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of pages
-- ----------------------------
INSERT INTO `pages` VALUES ('1', 'WEB', 'Dashboard', null, '1');
INSERT INTO `pages` VALUES ('2', 'WEB', 'Banner', null, '1');
INSERT INTO `pages` VALUES ('3', 'WEB', 'Welcome Page', null, '1');
INSERT INTO `pages` VALUES ('4', 'WEB', 'Home Page', null, '1');
INSERT INTO `pages` VALUES ('5', 'WEB', 'Category', null, '1');
INSERT INTO `pages` VALUES ('6', 'WEB', 'Genre', null, '1');
INSERT INTO `pages` VALUES ('7', 'WEB', 'Authors', null, '1');
INSERT INTO `pages` VALUES ('8', 'WEB', 'Publisher', null, '1');
INSERT INTO `pages` VALUES ('9', 'WEB', 'Events', null, '1');
INSERT INTO `pages` VALUES ('10', 'WEB', 'Book', null, '1');
INSERT INTO `pages` VALUES ('11', 'WEB', 'Reports', null, '1');
INSERT INTO `pages` VALUES ('12', 'WEB', 'User', null, '1');
INSERT INTO `pages` VALUES ('13', 'WEB', 'FAQ', null, '1');
INSERT INTO `pages` VALUES ('14', 'WEB', 'Book - Review', null, '1');
INSERT INTO `pages` VALUES ('15', 'WEB', 'User - Access', null, '1');

-- ----------------------------
-- Table structure for `payment`
-- ----------------------------
CREATE TABLE `payment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cardtype` varchar(45) DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `cart_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_payment_cart1_idx` (`cart_id`),
  CONSTRAINT `fk_payment_cart1` FOREIGN KEY (`cart_id`) REFERENCES `cart` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of personal_access_tokens
-- ----------------------------

-- ----------------------------
-- Table structure for `previllage`
-- ----------------------------
CREATE TABLE `previllage` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ability` int(11) DEFAULT NULL,
  `add` int(11) DEFAULT NULL,
  `update` int(11) DEFAULT NULL,
  `delete` int(11) DEFAULT NULL,
  `search` int(11) DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `pages_id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `usertype_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_previllage_pages1_idx` (`pages_id`),
  KEY `fk_previllage_usertype1_idx` (`usertype_id`),
  KEY `fk_previllage_user1_idx` (`user_id`),
  CONSTRAINT `fk_previllage_pages1` FOREIGN KEY (`pages_id`) REFERENCES `pages` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_previllage_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_previllage_usertype1` FOREIGN KEY (`usertype_id`) REFERENCES `usertype` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1400 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of previllage
-- ----------------------------
INSERT INTO `previllage` VALUES ('365', '1', '0', '0', '0', '0', '1', '1', null, '4');
INSERT INTO `previllage` VALUES ('366', '1', '1', '1', '1', '1', '1', '2', null, '4');
INSERT INTO `previllage` VALUES ('367', '1', '1', '1', '1', '1', '1', '3', null, '4');
INSERT INTO `previllage` VALUES ('368', '1', '1', '1', '1', '1', '1', '4', null, '4');
INSERT INTO `previllage` VALUES ('369', '1', '1', '1', '1', '1', '1', '5', null, '4');
INSERT INTO `previllage` VALUES ('370', '1', '1', '1', '1', '1', '1', '6', null, '4');
INSERT INTO `previllage` VALUES ('371', '1', '1', '1', '1', '1', '1', '7', null, '4');
INSERT INTO `previllage` VALUES ('372', '1', '1', '1', '1', '1', '1', '8', null, '4');
INSERT INTO `previllage` VALUES ('373', '1', '1', '1', '1', '1', '1', '9', null, '4');
INSERT INTO `previllage` VALUES ('374', '1', '1', '1', '1', '1', '1', '10', null, '4');
INSERT INTO `previllage` VALUES ('375', '1', '1', '1', '1', '1', '1', '11', null, '4');
INSERT INTO `previllage` VALUES ('376', '1', '1', '1', '1', '1', '1', '12', null, '4');
INSERT INTO `previllage` VALUES ('377', '1', '1', '1', '1', '1', '1', '13', null, '4');
INSERT INTO `previllage` VALUES ('378', '1', '0', '0', '1', '0', '1', '14', null, '4');
INSERT INTO `previllage` VALUES ('379', '1', '0', '0', '1', '0', '1', '15', null, '4');
INSERT INTO `previllage` VALUES ('1295', '0', '0', '0', '0', '0', '1', '1', null, '2');
INSERT INTO `previllage` VALUES ('1296', '1', '1', '1', '1', '0', '1', '2', null, '2');
INSERT INTO `previllage` VALUES ('1297', '1', '1', '1', '1', '0', '1', '3', null, '2');
INSERT INTO `previllage` VALUES ('1298', '1', '1', '1', '1', '0', '1', '4', null, '2');
INSERT INTO `previllage` VALUES ('1299', '1', '1', '0', '1', '0', '1', '5', null, '2');
INSERT INTO `previllage` VALUES ('1300', '1', '1', '1', '1', '0', '1', '6', null, '2');
INSERT INTO `previllage` VALUES ('1301', '1', '0', '0', '0', '0', '1', '7', null, '2');
INSERT INTO `previllage` VALUES ('1302', '1', '1', '1', '1', '0', '1', '8', null, '2');
INSERT INTO `previllage` VALUES ('1303', '1', '1', '1', '1', '0', '1', '9', null, '2');
INSERT INTO `previllage` VALUES ('1304', '1', '1', '1', '1', '1', '1', '10', null, '2');
INSERT INTO `previllage` VALUES ('1305', '1', '0', '0', '0', '1', '1', '11', null, '2');
INSERT INTO `previllage` VALUES ('1306', '1', '1', '1', '1', '1', '1', '12', null, '2');
INSERT INTO `previllage` VALUES ('1307', '1', '1', '1', '1', '0', '1', '13', null, '2');
INSERT INTO `previllage` VALUES ('1308', '1', '0', '0', '1', '1', '1', '14', null, '2');
INSERT INTO `previllage` VALUES ('1309', '1', '0', '0', '1', '0', '1', '15', null, '2');
INSERT INTO `previllage` VALUES ('1355', '1', '0', '0', '0', '0', '1', '1', null, '3');
INSERT INTO `previllage` VALUES ('1356', '0', '0', '0', '0', '0', '1', '2', null, '3');
INSERT INTO `previllage` VALUES ('1357', '0', '0', '0', '0', '0', '1', '3', null, '3');
INSERT INTO `previllage` VALUES ('1358', '0', '0', '0', '0', '0', '1', '4', null, '3');
INSERT INTO `previllage` VALUES ('1359', '0', '0', '0', '0', '0', '1', '5', null, '3');
INSERT INTO `previllage` VALUES ('1360', '0', '0', '0', '0', '0', '1', '6', null, '3');
INSERT INTO `previllage` VALUES ('1361', '0', '0', '0', '0', '0', '1', '7', null, '3');
INSERT INTO `previllage` VALUES ('1362', '0', '0', '0', '0', '0', '1', '8', null, '3');
INSERT INTO `previllage` VALUES ('1363', '0', '0', '0', '0', '0', '1', '9', null, '3');
INSERT INTO `previllage` VALUES ('1364', '1', '0', '0', '0', '1', '1', '10', null, '3');
INSERT INTO `previllage` VALUES ('1365', '1', '0', '0', '0', '1', '1', '11', null, '3');
INSERT INTO `previllage` VALUES ('1366', '0', '0', '0', '0', '0', '1', '12', null, '3');
INSERT INTO `previllage` VALUES ('1367', '0', '0', '0', '0', '0', '1', '13', null, '3');
INSERT INTO `previllage` VALUES ('1368', '1', '0', '0', '0', '1', '1', '14', null, '3');
INSERT INTO `previllage` VALUES ('1369', '0', '0', '0', '0', '0', '1', '15', null, '3');
INSERT INTO `previllage` VALUES ('1385', '1', '0', '0', '0', '0', '1', '1', null, '1');
INSERT INTO `previllage` VALUES ('1386', '1', '1', '1', '1', '0', '1', '2', null, '1');
INSERT INTO `previllage` VALUES ('1387', '1', '1', '1', '1', '0', '1', '3', null, '1');
INSERT INTO `previllage` VALUES ('1388', '1', '1', '1', '1', '0', '1', '4', null, '1');
INSERT INTO `previllage` VALUES ('1389', '1', '1', '1', '1', '0', '1', '5', null, '1');
INSERT INTO `previllage` VALUES ('1390', '1', '1', '1', '1', '0', '1', '6', null, '1');
INSERT INTO `previllage` VALUES ('1391', '1', '0', '0', '0', '0', '1', '7', null, '1');
INSERT INTO `previllage` VALUES ('1392', '1', '1', '1', '1', '0', '1', '8', null, '1');
INSERT INTO `previllage` VALUES ('1393', '1', '1', '1', '1', '0', '1', '9', null, '1');
INSERT INTO `previllage` VALUES ('1394', '1', '1', '1', '1', '1', '1', '10', null, '1');
INSERT INTO `previllage` VALUES ('1395', '1', '0', '0', '0', '1', '1', '11', null, '1');
INSERT INTO `previllage` VALUES ('1396', '1', '1', '1', '1', '1', '1', '12', null, '1');
INSERT INTO `previllage` VALUES ('1397', '1', '1', '1', '1', '0', '1', '13', null, '1');
INSERT INTO `previllage` VALUES ('1398', '1', '0', '0', '1', '1', '1', '14', null, '1');
INSERT INTO `previllage` VALUES ('1399', '1', '0', '0', '1', '0', '1', '15', null, '1');

-- ----------------------------
-- Table structure for `publisher`
-- ----------------------------
CREATE TABLE `publisher` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(500) DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `lastupdate` datetime DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_publisher_user1_idx` (`user_id`),
  CONSTRAINT `fk_publisher_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of publisher
-- ----------------------------

-- ----------------------------
-- Table structure for `purchase`
-- ----------------------------
CREATE TABLE `purchase` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `created` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `ordernum` longtext,
  `total` double DEFAULT NULL,
  `cart_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_purchase_cart1_idx` (`cart_id`),
  CONSTRAINT `fk_purchase_cart1` FOREIGN KEY (`cart_id`) REFERENCES `cart` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of purchase
-- ----------------------------

-- ----------------------------
-- Table structure for `purchase_details`
-- ----------------------------
CREATE TABLE `purchase_details` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(5) DEFAULT NULL,
  `price` double DEFAULT NULL,
  `purchase_id` int(11) NOT NULL,
  `book_id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_purchase_details_purchase1_idx` (`purchase_id`),
  KEY `fk_purchase_details_book1_idx` (`book_id`),
  KEY `fk_purchase_details_user1_idx` (`user_id`),
  CONSTRAINT `fk_purchase_details_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_purchase_details_purchase1` FOREIGN KEY (`purchase_id`) REFERENCES `purchase` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_purchase_details_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of purchase_details
-- ----------------------------

-- ----------------------------
-- Table structure for `review`
-- ----------------------------
CREATE TABLE `review` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` longtext,
  `rating` double DEFAULT NULL,
  `face_comment` varchar(2) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `actionuser` varchar(45) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `book_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_review_user1_idx` (`user_id`),
  KEY `fk_review_book1_idx` (`book_id`),
  CONSTRAINT `fk_review_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_review_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for `usertype`
-- ----------------------------
CREATE TABLE `usertype` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of usertype
-- ----------------------------
INSERT INTO `usertype` VALUES ('1', 'Admin', '1');
INSERT INTO `usertype` VALUES ('2', 'Moderator', '1');
INSERT INTO `usertype` VALUES ('3', 'Author', '1');
INSERT INTO `usertype` VALUES ('4', 'Customer', '1');

-- ----------------------------
-- Table structure for `verify_code`
-- ----------------------------
CREATE TABLE `verify_code` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `datetime` datetime DEFAULT NULL,
  `code` mediumtext,
  `type` varchar(45) DEFAULT 'email or sms',
  `section` varchar(100) DEFAULT 'login or childmode forgot pw',
  `status` varchar(45) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_verify_code_user1_idx` (`user_id`),
  CONSTRAINT `fk_verify_code_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of verify_code
-- ----------------------------

-- ----------------------------
-- Table structure for `welcome_page`
-- ----------------------------
CREATE TABLE `welcome_page` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `img_num` int(11) DEFAULT NULL,
  `create` datetime DEFAULT NULL,
  `name` mediumtext,
  `url` longtext,
  `status` varchar(5) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_banners_user1_idx` (`user_id`),
  CONSTRAINT `fk_banners_user10` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of welcome_page
-- ----------------------------

-- ----------------------------
-- Table structure for `wishlist`
-- ----------------------------
CREATE TABLE `wishlist` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `created` datetime DEFAULT NULL,
  `status` varchar(5) DEFAULT NULL,
  `book_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_wishlist_book1_idx` (`book_id`),
  KEY `fk_wishlist_user1_idx` (`user_id`),
  CONSTRAINT `fk_wishlist_book1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_wishlist_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of wishlist
-- ----------------------------
