删除外键,增加必要索引
This commit is contained in:
parent
19b9d79477
commit
334ec465a2
|
@ -2,15 +2,15 @@
|
|||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : localhost
|
||||
Source Server Version : 50621
|
||||
Source Server Version : 50528
|
||||
Source Host : localhost:3306
|
||||
Source Database : zheng
|
||||
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 50621
|
||||
Target Server Version : 50528
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 2016-10-16 20:44:49
|
||||
Date: 2016-10-17 17:23:58
|
||||
*/
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
@ -51,7 +51,7 @@ CREATE TABLE `cms_article` (
|
|||
`ctime` bigint(20) unsigned NOT NULL COMMENT '创建时间',
|
||||
`orders` bigint(20) unsigned NOT NULL COMMENT '排序',
|
||||
PRIMARY KEY (`article_id`),
|
||||
KEY `cms_article_orders` (`orders`)
|
||||
KEY `cms_article_orders` (`orders`) USING BTREE COMMENT '排序索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章表';
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -63,10 +63,8 @@ CREATE TABLE `cms_article_category` (
|
|||
`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`),
|
||||
CONSTRAINT `cms_article_category_article_id` FOREIGN KEY (`article_id`) REFERENCES `cms_article` (`article_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `cms_article_category_category_id` FOREIGN KEY (`category_id`) REFERENCES `cms_category` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
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='文章类目表';
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -78,10 +76,8 @@ CREATE TABLE `cms_article_tag` (
|
|||
`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`),
|
||||
KEY `cms_article_tag_tag_id` (`tag_id`),
|
||||
CONSTRAINT `cms_article_tag_article_id` FOREIGN KEY (`article_id`) REFERENCES `cms_article` (`article_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `cms_article_tag_tag_id` FOREIGN KEY (`tag_id`) REFERENCES `cms_tag` (`tag_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
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='文章标签表';
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -100,11 +96,11 @@ CREATE TABLE `cms_category` (
|
|||
`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`),
|
||||
CONSTRAINT `cms_category_pid` FOREIGN KEY (`pid`) REFERENCES `cms_category` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='类目表';
|
||||
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
|
||||
|
@ -115,10 +111,8 @@ CREATE TABLE `cms_category_tag` (
|
|||
`category_id` int(10) unsigned NOT NULL,
|
||||
`tag_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`category_tag_id`),
|
||||
KEY `cms_category_tag_category_id` (`category_id`),
|
||||
KEY `cms_category_tag_tag_id` (`tag_id`),
|
||||
CONSTRAINT `cms_category_tag_category_id` FOREIGN KEY (`category_id`) REFERENCES `cms_category` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `cms_category_tag_tag_id` FOREIGN KEY (`tag_id`) REFERENCES `cms_tag` (`tag_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
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=' 分类标签表';
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -134,7 +128,7 @@ CREATE TABLE `cms_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,
|
||||
`ctime` bigint(20) NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (`comment_id`),
|
||||
KEY `cms_comment_article_id` (`article_id`),
|
||||
KEY `cms_comment_pid` (`pid`),
|
||||
|
@ -156,8 +150,8 @@ CREATE TABLE `cms_tag` (
|
|||
`ctime` bigint(20) unsigned NOT NULL COMMENT '创建时间',
|
||||
`orders` bigint(20) unsigned NOT NULL COMMENT 'orders',
|
||||
PRIMARY KEY (`tag_id`),
|
||||
KEY `cms_tag_orders` (`orders`),
|
||||
KEY `cms_tag_alias` (`alias`)
|
||||
KEY `cms_tag_orders` (`orders`) USING BTREE COMMENT '排序索引',
|
||||
KEY `cms_tag_alias` (`alias`) USING BTREE COMMENT '别名索引'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='标签表';
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -173,4 +167,4 @@ CREATE TABLE `user` (
|
|||
`ctime` bigint(20) DEFAULT NULL,
|
||||
`content` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 COMMENT='用户表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8 COMMENT='用户表';
|
||||
|
|
Loading…
Reference in New Issue