add database sql
This commit is contained in:
parent
814aae9815
commit
f7221b2328
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : localhost
|
||||
Source Server Version : 50621
|
||||
Source Host : localhost:3306
|
||||
Source Database : zheng
|
||||
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 50621
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 2016-10-05 00:30:08
|
||||
*/
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for book
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `book`;
|
||||
CREATE TABLE `book` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`userid` int(10) unsigned NOT NULL,
|
||||
`name` varchar(45) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FK_book_1` (`userid`),
|
||||
CONSTRAINT `book_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COMMENT='用户书籍表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `user`;
|
||||
CREATE TABLE `user` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(32) DEFAULT NULL,
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
`nickname` varchar(32) DEFAULT NULL,
|
||||
`sex` int(11) DEFAULT NULL COMMENT '0未知,1男,2女',
|
||||
`ctime` bigint(20) DEFAULT NULL,
|
||||
`content` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COMMENT='用户表';
|
Loading…
Reference in New Issue