-
Notifications
You must be signed in to change notification settings - Fork 0
/
yiiblog2.0.sql
142 lines (126 loc) · 6.02 KB
/
yiiblog2.0.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50540
Source Host : 127.0.0.1:3306
Source Database : yiiblog2.0
Target Server Type : MYSQL
Target Server Version : 50540
File Encoding : 65001
Date: 2017-03-29 18:10:21
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `admin`
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`username` varchar(255) NOT NULL COMMENT '用户名',
`auth_key` varchar(32) NOT NULL COMMENT '自动登录key',
`password_hash` varchar(255) NOT NULL COMMENT '加密密码',
`password_reset_token` varchar(255) DEFAULT NULL COMMENT '重置密码token',
`email_validate_token` varchar(255) DEFAULT NULL COMMENT '邮箱验证token',
`email` varchar(255) NOT NULL COMMENT '邮箱',
`role` smallint(6) NOT NULL DEFAULT '10' COMMENT '角色等级',
`status` smallint(6) NOT NULL DEFAULT '10' COMMENT '状态',
`avatar` varchar(255) DEFAULT NULL COMMENT '头像',
`vip_lv` int(11) DEFAULT '0' COMMENT 'vip等级',
`created_at` int(11) NOT NULL COMMENT '创建时间',
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='会员表';
-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES ('1', 'admin', 'hWV8gfvsT4zzIw-cfd4W3kfovjC7sDj6', '$2y$13$PO8Nb3OOMbQjv/EGnpuFvO9pz1Nhkz6KU6YZYLex84akFbtE.9hG2', null, null, 'test@qq.com', '10', '10', null, '0', '1490670707', '1490670707');
-- ----------------------------
-- Table structure for `cats`
-- ----------------------------
DROP TABLE IF EXISTS `cats`;
CREATE TABLE `cats` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`cat_name` varchar(255) DEFAULT NULL COMMENT '分类名称',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='分类表';
-- ----------------------------
-- Records of cats
-- ----------------------------
INSERT INTO `cats` VALUES ('1', '分类1');
INSERT INTO `cats` VALUES ('2', '分类2');
-- ----------------------------
-- Table structure for `posts`
-- ----------------------------
DROP TABLE IF EXISTS `posts`;
CREATE TABLE `posts` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`title` varchar(255) DEFAULT NULL COMMENT '标题',
`summary` varchar(255) DEFAULT NULL COMMENT '摘要',
`content` text COMMENT '内容',
`label_img` varchar(255) DEFAULT NULL COMMENT '标签图',
`cat_id` int(11) DEFAULT NULL COMMENT '分类id',
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名',
`is_valid` tinyint(1) DEFAULT '0' COMMENT '是否有效:0-未发布 1-已发布',
`created_at` int(11) DEFAULT NULL COMMENT '创建时间',
`updated_at` int(11) DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_cat_valid` (`cat_id`,`is_valid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='文章主表';
-- ----------------------------
-- Records of posts
-- ----------------------------
INSERT INTO `posts` VALUES ('4', 'fefefefe', 'fefe', '<p>fefe</p>', '', '1', '1', 'test', '1', '1490775797', '1490775797');
-- ----------------------------
-- Table structure for `relation_post_tags`
-- ----------------------------
DROP TABLE IF EXISTS `relation_post_tags`;
CREATE TABLE `relation_post_tags` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`post_id` int(11) DEFAULT NULL COMMENT '文章ID',
`tag_id` int(11) DEFAULT NULL COMMENT '标签ID',
PRIMARY KEY (`id`),
UNIQUE KEY `post_id` (`post_id`,`tag_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文章和标签关系表';
-- ----------------------------
-- Records of relation_post_tags
-- ----------------------------
-- ----------------------------
-- Table structure for `tags`
-- ----------------------------
DROP TABLE IF EXISTS `tags`;
CREATE TABLE `tags` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`tag_name` varchar(255) DEFAULT NULL COMMENT '标签名称',
`post_num` int(11) DEFAULT '0' COMMENT '关联文章数',
PRIMARY KEY (`id`),
UNIQUE KEY `tag_name` (`tag_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='标签表';
-- ----------------------------
-- Records of tags
-- ----------------------------
-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`username` varchar(255) NOT NULL COMMENT '用户名',
`auth_key` varchar(32) NOT NULL COMMENT '自动登录key',
`password_hash` varchar(255) NOT NULL COMMENT '加密密码',
`password_reset_token` varchar(255) DEFAULT NULL COMMENT '重置密码token',
`email_validate_token` varchar(255) DEFAULT NULL COMMENT '邮箱验证token',
`email` varchar(255) NOT NULL COMMENT '邮箱',
`role` smallint(6) NOT NULL DEFAULT '10' COMMENT '角色等级',
`status` smallint(6) NOT NULL DEFAULT '10' COMMENT '状态',
`avatar` varchar(255) DEFAULT NULL COMMENT '头像',
`vip_lv` int(11) DEFAULT '0' COMMENT 'vip等级',
`created_at` int(11) NOT NULL COMMENT '创建时间',
`updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='会员表';
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'test', 'hWV8gfvsT4zzIw-cfd4W3kfovjC7sDj6', '$2y$13$PO8Nb3OOMbQjv/EGnpuFvO9pz1Nhkz6KU6YZYLex84akFbtE.9hG2', null, null, 'test@qq.com', '10', '10', null, '0', '1490670707', '1490670707');
INSERT INTO `user` VALUES ('2', 'test_01', 'xxi4ozM9HJTzmv6ACHwZWkdaP2W1i_e1', '$2y$13$YL3unMMuFI/uKuQ52O.mEeATDSCKrRo8RLUAwB/tgDUazTpKEo2OS', null, null, 'test_01@qq.com', '10', '10', null, '0', '1490689481', '1490689481');