使用PowerdDesigner建模
This commit is contained in:
parent
c689cf3efb
commit
d179487132
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,170 +1,228 @@
|
|||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
/*==============================================================*/
|
||||
/* DBMS name: MySQL 5.0 */
|
||||
/* Created on: 2016/11/2 22:31:07 */
|
||||
/*==============================================================*/
|
||||
|
||||
Source Server : localhost
|
||||
Source Server Version : 50528
|
||||
Source Host : localhost:3306
|
||||
Source Database : zheng
|
||||
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 50528
|
||||
File Encoding : 65001
|
||||
drop table if exists book;
|
||||
|
||||
Date: 2016-10-17 17:23:58
|
||||
*/
|
||||
drop table if exists cms_article;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
drop table if exists cms_article_category;
|
||||
|
||||
-- ----------------------------
|
||||
-- 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='用户书籍表';
|
||||
drop table if exists cms_article_tag;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_article
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_article`;
|
||||
CREATE TABLE `cms_article` (
|
||||
`article_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '文章编号',
|
||||
`title` varchar(200) NOT NULL COMMENT '文章标题',
|
||||
`author` varchar(50) DEFAULT NULL COMMENT '文章原作者',
|
||||
`fromurl` varchar(300) DEFAULT NULL COMMENT '转载来源网址',
|
||||
`image` varchar(300) DEFAULT NULL COMMENT '封面图',
|
||||
`keywords` varchar(100) DEFAULT NULL COMMENT '关键字',
|
||||
`description` varchar(500) DEFAULT NULL COMMENT '简介',
|
||||
`type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '类型(1:普通,2:热门...)',
|
||||
`allowcomments` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否允许评论(0:不允许,1:允许)',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态(-1:审核不通过回收站,0:刚发布未审核,1:已审核公开,2:已审核个人)',
|
||||
`content` mediumtext COMMENT '内容',
|
||||
`user_id` int(10) unsigned NOT NULL COMMENT '发布人id',
|
||||
`up` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '顶',
|
||||
`down` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '踩',
|
||||
`readnumber` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '阅读数量',
|
||||
`ctime` bigint(20) unsigned NOT NULL COMMENT '创建时间',
|
||||
`orders` bigint(20) unsigned NOT NULL COMMENT '排序',
|
||||
PRIMARY KEY (`article_id`),
|
||||
KEY `cms_article_orders` (`orders`) USING BTREE COMMENT '排序索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章表';
|
||||
drop table if exists cms_category;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_article_category
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_article_category`;
|
||||
CREATE TABLE `cms_article_category` (
|
||||
`article_category_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`article_id` int(10) unsigned NOT NULL,
|
||||
`category_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`article_category_id`),
|
||||
KEY `cms_article_category_article_id` (`article_id`) USING BTREE COMMENT '文章id索引',
|
||||
KEY `cms_article_category_category_id` (`category_id`) USING BTREE COMMENT '类目id索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章类目表';
|
||||
drop table if exists cms_category_tag;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_article_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_article_tag`;
|
||||
CREATE TABLE `cms_article_tag` (
|
||||
`article_tag_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`article_id` int(10) unsigned NOT NULL,
|
||||
`tag_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`article_tag_id`),
|
||||
KEY `cms_article_tag_article_id` (`article_id`) USING BTREE COMMENT '文章id索引',
|
||||
KEY `cms_article_tag_tag_id` (`tag_id`) USING BTREE COMMENT '标签id索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章标签表';
|
||||
drop table if exists cms_comment;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_category
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_category`;
|
||||
CREATE TABLE `cms_category` (
|
||||
`category_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '类目编号',
|
||||
`pid` int(10) unsigned NOT NULL COMMENT '上级编号',
|
||||
`level` tinyint(3) NOT NULL COMMENT '层级',
|
||||
`name` varchar(20) NOT NULL COMMENT '名称',
|
||||
`description` varchar(200) DEFAULT NULL COMMENT '描述',
|
||||
`icon` varchar(50) DEFAULT NULL COMMENT '图标',
|
||||
`type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '类型(1:普通,2:热门...)',
|
||||
`alias` varchar(20) DEFAULT NULL COMMENT '别名',
|
||||
`ctime` bigint(20) unsigned NOT NULL COMMENT '创建时间',
|
||||
`orders` bigint(255) unsigned NOT NULL COMMENT '排序',
|
||||
PRIMARY KEY (`category_id`),
|
||||
KEY `cms_category_orders` (`orders`) USING BTREE COMMENT '排序字段索引',
|
||||
KEY `cms_category_pid` (`pid`) USING BTREE COMMENT '父类目索引',
|
||||
KEY `cms_category_alias` (`alias`) USING BTREE COMMENT '别名索引',
|
||||
KEY `cms_category_level` (`level`) USING BTREE COMMENT '类目层级索引'
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='类目表';
|
||||
drop table if exists cms_tag;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_category_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_category_tag`;
|
||||
CREATE TABLE `cms_category_tag` (
|
||||
`category_tag_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`category_id` int(10) unsigned NOT NULL,
|
||||
`tag_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`category_tag_id`),
|
||||
KEY `cms_category_tag_tag_id` (`tag_id`) USING BTREE COMMENT '标签id索引',
|
||||
KEY `cms_category_tag_category_id` (`category_id`) USING BTREE COMMENT '类目id索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT=' 分类标签表';
|
||||
drop table if exists user;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_comment
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_comment`;
|
||||
CREATE TABLE `cms_comment` (
|
||||
`comment_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '回复楼中楼id',
|
||||
`article_id` int(10) unsigned NOT NULL COMMENT '文章id',
|
||||
`user_id` int(10) unsigned NOT NULL COMMENT '用户id',
|
||||
`content` text NOT NULL COMMENT '评论内容',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态(-1:审核不通过,0:未审核,1:已审核通过)',
|
||||
`ip` varchar(30) DEFAULT NULL COMMENT '评论人ip地址',
|
||||
`agent` varchar(200) DEFAULT NULL COMMENT '评论人终端信息',
|
||||
`ctime` bigint(20) NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (`comment_id`),
|
||||
KEY `cms_comment_article_id` (`article_id`),
|
||||
KEY `cms_comment_pid` (`pid`),
|
||||
CONSTRAINT `cms_comment_article_id` FOREIGN KEY (`article_id`) REFERENCES `cms_article` (`article_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `cms_comment_pid` FOREIGN KEY (`pid`) REFERENCES `cms_comment` (`comment_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
/*==============================================================*/
|
||||
/* Table: book */
|
||||
/*==============================================================*/
|
||||
create table book
|
||||
(
|
||||
book_id int(10) unsigned not null auto_increment comment '编号',
|
||||
user_id int(10) unsigned not null comment '用户编号',
|
||||
name varchar(45) not null comment '书名',
|
||||
primary key (book_id),
|
||||
key FK_book_1 (user_id)
|
||||
)
|
||||
ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COMMENT='用户书籍表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_tag`;
|
||||
CREATE TABLE `cms_tag` (
|
||||
`tag_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '标签编号',
|
||||
`name` varchar(20) NOT NULL COMMENT '名称',
|
||||
`description` varchar(200) DEFAULT NULL COMMENT '描述',
|
||||
`icon` varchar(50) DEFAULT NULL COMMENT '图标',
|
||||
`type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '类型(1:普通,2:热门...)',
|
||||
`alias` varchar(20) DEFAULT NULL COMMENT '别名',
|
||||
`ctime` bigint(20) unsigned NOT NULL COMMENT '创建时间',
|
||||
`orders` bigint(20) unsigned NOT NULL COMMENT 'orders',
|
||||
PRIMARY KEY (`tag_id`),
|
||||
KEY `cms_tag_orders` (`orders`) USING BTREE COMMENT '排序索引',
|
||||
KEY `cms_tag_alias` (`alias`) USING BTREE COMMENT '别名索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='标签表';
|
||||
alter table book comment 'book 书';
|
||||
|
||||
/*==============================================================*/
|
||||
/* Table: cms_article */
|
||||
/*==============================================================*/
|
||||
create table cms_article
|
||||
(
|
||||
article_id int(10) unsigned not null auto_increment comment '文章编号',
|
||||
title varchar(200) not null comment '文章标题',
|
||||
author varchar(50) default NULL comment '文章原作者',
|
||||
fromurl varchar(300) default NULL comment '转载来源网址',
|
||||
image varchar(300) default NULL comment '封面图',
|
||||
keywords varchar(100) default NULL comment '关键字',
|
||||
description varchar(500) default NULL comment '简介',
|
||||
type tinyint(4) not null default 1 comment '类型(1:普通,2:热门...)',
|
||||
allowcomments tinyint(4) not null default 1 comment '是否允许评论(0:不允许,1:允许)',
|
||||
status tinyint(4) not null default 1 comment '状态(-1:审核不通过回收站,0:刚发布未审核,1:已审核公开,2:已审核个人)',
|
||||
content mediumtext comment '内容',
|
||||
user_id int(10) unsigned not null comment '发布人id',
|
||||
up int(10) unsigned not null default 0 comment '顶',
|
||||
down int(10) unsigned not null default 0 comment '踩',
|
||||
readnumber int(10) unsigned not null default 0 comment '阅读数量',
|
||||
ctime bigint(20) unsigned not null comment '创建时间',
|
||||
orders bigint(20) unsigned not null comment '排序',
|
||||
primary key (article_id),
|
||||
key cms_article_orders (orders)
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章表';
|
||||
|
||||
alter table cms_article comment 'cms_article 文章表';
|
||||
|
||||
/*==============================================================*/
|
||||
/* Table: cms_article_category */
|
||||
/*==============================================================*/
|
||||
create table cms_article_category
|
||||
(
|
||||
article_category_id int(10) unsigned not null auto_increment,
|
||||
article_id int(10) unsigned not null,
|
||||
category_id int(10) unsigned not null,
|
||||
primary key (article_category_id),
|
||||
key cms_article_category_article_id (article_id),
|
||||
key cms_article_category_category_id (category_id)
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章类目表';
|
||||
|
||||
alter table cms_article_category comment 'cms_article_category 文章类目关联表';
|
||||
|
||||
/*==============================================================*/
|
||||
/* Table: cms_article_tag */
|
||||
/*==============================================================*/
|
||||
create table cms_article_tag
|
||||
(
|
||||
article_tag_id int(10) unsigned not null auto_increment comment '编号',
|
||||
article_id int(10) unsigned not null comment '文章编号',
|
||||
tag_id int(10) unsigned not null comment '标签编号',
|
||||
primary key (article_tag_id),
|
||||
key cms_article_tag_article_id (article_id),
|
||||
key cms_article_tag_tag_id (tag_id)
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章标签表';
|
||||
|
||||
alter table cms_article_tag comment 'cms_article_tag 文章标签关联表';
|
||||
|
||||
/*==============================================================*/
|
||||
/* Table: cms_category */
|
||||
/*==============================================================*/
|
||||
create table cms_category
|
||||
(
|
||||
category_id int(10) unsigned not null auto_increment comment '类目编号',
|
||||
pid int(10) unsigned comment '上级编号',
|
||||
level tinyint(3) not null comment '层级',
|
||||
name varchar(20) not null comment '名称',
|
||||
description varchar(200) default NULL comment '描述',
|
||||
icon varchar(50) default NULL comment '图标',
|
||||
type tinyint(3) not null default 1 comment '类型(1:普通,2:热门...)',
|
||||
alias varchar(20) default NULL comment '别名',
|
||||
ctime bigint(20) unsigned not null comment '创建时间',
|
||||
orders bigint(255) unsigned not null comment '排序',
|
||||
primary key (category_id),
|
||||
key cms_category_orders (orders),
|
||||
key cms_category_pid (pid),
|
||||
key cms_category_alias (alias),
|
||||
key cms_category_level (level)
|
||||
)
|
||||
ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='类目表';
|
||||
|
||||
alter table cms_category comment 'cms_category 类目表';
|
||||
|
||||
/*==============================================================*/
|
||||
/* Table: cms_category_tag */
|
||||
/*==============================================================*/
|
||||
create table cms_category_tag
|
||||
(
|
||||
category_tag_id int(10) unsigned not null auto_increment comment '编号',
|
||||
category_id int(10) unsigned not null comment '类目编号',
|
||||
tag_id int(10) unsigned not null comment '标签编号',
|
||||
primary key (category_tag_id),
|
||||
key cms_category_tag_tag_id (tag_id),
|
||||
key cms_category_tag_category_id (category_id)
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT=' 分类标签表';
|
||||
|
||||
alter table cms_category_tag comment 'cms_category_tag 类目标签关联表';
|
||||
|
||||
/*==============================================================*/
|
||||
/* Table: cms_comment */
|
||||
/*==============================================================*/
|
||||
create table cms_comment
|
||||
(
|
||||
comment_id int(10) unsigned not null auto_increment comment '编号',
|
||||
pid int(10) unsigned default 0 comment '回复楼中楼编号回复楼中楼编号',
|
||||
article_id int(10) unsigned not null comment '文章编号',
|
||||
user_id int(10) unsigned not null comment '用户编号',
|
||||
content text not null comment '评论内容',
|
||||
status tinyint(4) not null default 1 comment '状态(-1:审核不通过,0:未审核,1:已审核通过)',
|
||||
ip varchar(30) default NULL comment '评论人ip地址',
|
||||
agent varchar(200) default NULL comment '评论人终端信息',
|
||||
ctime bigint(20) not null comment '创建时间',
|
||||
primary key (comment_id),
|
||||
key cms_comment_article_id (article_id)
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
alter table cms_comment comment 'cms_comment 评论表';
|
||||
|
||||
/*==============================================================*/
|
||||
/* Table: cms_tag */
|
||||
/*==============================================================*/
|
||||
create table cms_tag
|
||||
(
|
||||
tag_id int(10) unsigned not null auto_increment comment '标签编号',
|
||||
name varchar(20) not null comment '名称',
|
||||
description varchar(200) default NULL comment '描述',
|
||||
icon varchar(50) default NULL comment '图标',
|
||||
type tinyint(4) not null default 1 comment '类型(1:普通,2:热门...)',
|
||||
alias varchar(20) default NULL comment '别名',
|
||||
ctime bigint(20) unsigned not null comment '创建时间',
|
||||
orders bigint(20) unsigned not null comment '排序',
|
||||
primary key (tag_id),
|
||||
key cms_tag_orders (orders),
|
||||
key cms_tag_alias (alias)
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='标签表';
|
||||
|
||||
alter table cms_tag comment 'cms_tag 标签表';
|
||||
|
||||
/*==============================================================*/
|
||||
/* Table: user */
|
||||
/*==============================================================*/
|
||||
create table user
|
||||
(
|
||||
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 (user_id)
|
||||
)
|
||||
ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8 COMMENT='用户表';
|
||||
|
||||
alter table user comment 'user 用户';
|
||||
|
||||
alter table book add constraint FK_Reference_9 foreign key (user_id)
|
||||
references user (user_id) on delete restrict on update restrict;
|
||||
|
||||
alter table cms_article_category add constraint FK_Reference_7 foreign key (category_id)
|
||||
references cms_category (category_id) on delete restrict on update restrict;
|
||||
|
||||
alter table cms_article_category add constraint FK_Reference_8 foreign key (article_id)
|
||||
references cms_article (article_id) on delete restrict on update restrict;
|
||||
|
||||
alter table cms_article_tag add constraint FK_Reference_3 foreign key (article_id)
|
||||
references cms_article (article_id) on delete restrict on update restrict;
|
||||
|
||||
alter table cms_article_tag add constraint FK_Reference_4 foreign key (tag_id)
|
||||
references cms_tag (tag_id) on delete restrict on update restrict;
|
||||
|
||||
alter table cms_category_tag add constraint FK_Reference_5 foreign key (category_id)
|
||||
references cms_category (category_id) on delete restrict on update restrict;
|
||||
|
||||
alter table cms_category_tag add constraint FK_Reference_6 foreign key (tag_id)
|
||||
references cms_tag (tag_id) on delete restrict on update restrict;
|
||||
|
||||
alter table cms_comment add constraint cms_comment_article_id foreign key (article_id)
|
||||
references cms_article (article_id) on delete cascade on update cascade;
|
||||
|
||||
alter table cms_comment add constraint cms_comment_pid foreign key (pid)
|
||||
references cms_comment (comment_id) on delete cascade on update cascade;
|
||||
|
||||
-- ----------------------------
|
||||
-- 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=56 DEFAULT CHARSET=utf8 COMMENT='用户表';
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : localhost
|
||||
Source Server Version : 50528
|
||||
Source Host : localhost:3306
|
||||
Source Database : zheng
|
||||
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 50528
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 2016-10-17 17:23:58
|
||||
*/
|
||||
|
||||
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 cms_article
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_article`;
|
||||
CREATE TABLE `cms_article` (
|
||||
`article_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '文章编号',
|
||||
`title` varchar(200) NOT NULL COMMENT '文章标题',
|
||||
`author` varchar(50) DEFAULT NULL COMMENT '文章原作者',
|
||||
`fromurl` varchar(300) DEFAULT NULL COMMENT '转载来源网址',
|
||||
`image` varchar(300) DEFAULT NULL COMMENT '封面图',
|
||||
`keywords` varchar(100) DEFAULT NULL COMMENT '关键字',
|
||||
`description` varchar(500) DEFAULT NULL COMMENT '简介',
|
||||
`type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '类型(1:普通,2:热门...)',
|
||||
`allowcomments` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否允许评论(0:不允许,1:允许)',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态(-1:审核不通过回收站,0:刚发布未审核,1:已审核公开,2:已审核个人)',
|
||||
`content` mediumtext COMMENT '内容',
|
||||
`user_id` int(10) unsigned NOT NULL COMMENT '发布人id',
|
||||
`up` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '顶',
|
||||
`down` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '踩',
|
||||
`readnumber` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '阅读数量',
|
||||
`ctime` bigint(20) unsigned NOT NULL COMMENT '创建时间',
|
||||
`orders` bigint(20) unsigned NOT NULL COMMENT '排序',
|
||||
PRIMARY KEY (`article_id`),
|
||||
KEY `cms_article_orders` (`orders`) USING BTREE COMMENT '排序索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_article_category
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_article_category`;
|
||||
CREATE TABLE `cms_article_category` (
|
||||
`article_category_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`article_id` int(10) unsigned NOT NULL,
|
||||
`category_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`article_category_id`),
|
||||
KEY `cms_article_category_article_id` (`article_id`) USING BTREE COMMENT '文章id索引',
|
||||
KEY `cms_article_category_category_id` (`category_id`) USING BTREE COMMENT '类目id索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章类目表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_article_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_article_tag`;
|
||||
CREATE TABLE `cms_article_tag` (
|
||||
`article_tag_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`article_id` int(10) unsigned NOT NULL,
|
||||
`tag_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`article_tag_id`),
|
||||
KEY `cms_article_tag_article_id` (`article_id`) USING BTREE COMMENT '文章id索引',
|
||||
KEY `cms_article_tag_tag_id` (`tag_id`) USING BTREE COMMENT '标签id索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章标签表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_category
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_category`;
|
||||
CREATE TABLE `cms_category` (
|
||||
`category_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '类目编号',
|
||||
`pid` int(10) unsigned NOT NULL COMMENT '上级编号',
|
||||
`level` tinyint(3) NOT NULL COMMENT '层级',
|
||||
`name` varchar(20) NOT NULL COMMENT '名称',
|
||||
`description` varchar(200) DEFAULT NULL COMMENT '描述',
|
||||
`icon` varchar(50) DEFAULT NULL COMMENT '图标',
|
||||
`type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '类型(1:普通,2:热门...)',
|
||||
`alias` varchar(20) DEFAULT NULL COMMENT '别名',
|
||||
`ctime` bigint(20) unsigned NOT NULL COMMENT '创建时间',
|
||||
`orders` bigint(255) unsigned NOT NULL COMMENT '排序',
|
||||
PRIMARY KEY (`category_id`),
|
||||
KEY `cms_category_orders` (`orders`) USING BTREE COMMENT '排序字段索引',
|
||||
KEY `cms_category_pid` (`pid`) USING BTREE COMMENT '父类目索引',
|
||||
KEY `cms_category_alias` (`alias`) USING BTREE COMMENT '别名索引',
|
||||
KEY `cms_category_level` (`level`) USING BTREE COMMENT '类目层级索引'
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='类目表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_category_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_category_tag`;
|
||||
CREATE TABLE `cms_category_tag` (
|
||||
`category_tag_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`category_id` int(10) unsigned NOT NULL,
|
||||
`tag_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`category_tag_id`),
|
||||
KEY `cms_category_tag_tag_id` (`tag_id`) USING BTREE COMMENT '标签id索引',
|
||||
KEY `cms_category_tag_category_id` (`category_id`) USING BTREE COMMENT '类目id索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT=' 分类标签表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_comment
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_comment`;
|
||||
CREATE TABLE `cms_comment` (
|
||||
`comment_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '回复楼中楼id',
|
||||
`article_id` int(10) unsigned NOT NULL COMMENT '文章id',
|
||||
`user_id` int(10) unsigned NOT NULL COMMENT '用户id',
|
||||
`content` text NOT NULL COMMENT '评论内容',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态(-1:审核不通过,0:未审核,1:已审核通过)',
|
||||
`ip` varchar(30) DEFAULT NULL COMMENT '评论人ip地址',
|
||||
`agent` varchar(200) DEFAULT NULL COMMENT '评论人终端信息',
|
||||
`ctime` bigint(20) NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (`comment_id`),
|
||||
KEY `cms_comment_article_id` (`article_id`),
|
||||
KEY `cms_comment_pid` (`pid`),
|
||||
CONSTRAINT `cms_comment_article_id` FOREIGN KEY (`article_id`) REFERENCES `cms_article` (`article_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `cms_comment_pid` FOREIGN KEY (`pid`) REFERENCES `cms_comment` (`comment_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cms_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cms_tag`;
|
||||
CREATE TABLE `cms_tag` (
|
||||
`tag_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '标签编号',
|
||||
`name` varchar(20) NOT NULL COMMENT '名称',
|
||||
`description` varchar(200) DEFAULT NULL COMMENT '描述',
|
||||
`icon` varchar(50) DEFAULT NULL COMMENT '图标',
|
||||
`type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '类型(1:普通,2:热门...)',
|
||||
`alias` varchar(20) DEFAULT NULL COMMENT '别名',
|
||||
`ctime` bigint(20) unsigned NOT NULL COMMENT '创建时间',
|
||||
`orders` bigint(20) unsigned NOT NULL COMMENT 'orders',
|
||||
PRIMARY KEY (`tag_id`),
|
||||
KEY `cms_tag_orders` (`orders`) USING BTREE COMMENT '排序索引',
|
||||
KEY `cms_tag_alias` (`alias`) USING BTREE COMMENT '别名索引'
|
||||
) ENGINE=InnoDB 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=56 DEFAULT CHARSET=utf8 COMMENT='用户表';
|
Loading…
Reference in New Issue