-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathblog.sql
More file actions
164 lines (154 loc) · 5.81 KB
/
blog.sql
File metadata and controls
164 lines (154 loc) · 5.81 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for comments
-- ----------------------------
DROP TABLE IF EXISTS `comments`;
CREATE TABLE `comments` (
`coid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cid` int(10) unsigned DEFAULT '0',
`created` int(10) unsigned DEFAULT '0',
`author` varchar(200) DEFAULT NULL,
`authorId` int(10) unsigned DEFAULT '0',
`ownerId` int(10) unsigned DEFAULT '0',
`email` varchar(200) DEFAULT NULL,
`url` varchar(200) DEFAULT NULL,
`ip` varchar(64) DEFAULT NULL,
`agent` varchar(200) DEFAULT NULL,
`text` text,
`type` varchar(16) DEFAULT 'comment',
`status` varchar(16) DEFAULT 'approved',
`parent` int(10) unsigned DEFAULT '0',
`reply` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`coid`),
KEY `cid` (`cid`),
KEY `created` (`created`),
CONSTRAINT `comments_posts_cid_fk` FOREIGN KEY (`cid`) REFERENCES `posts` (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=2174 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for fields
-- ----------------------------
DROP TABLE IF EXISTS `fields`;
CREATE TABLE `fields` (
`cid` int(10) unsigned NOT NULL,
`type` varchar(200) NOT NULL,
`value` text,
PRIMARY KEY (`cid`,`type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for gallery
-- ----------------------------
DROP TABLE IF EXISTS `gallery`;
CREATE TABLE `gallery` (
`gid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'gallery表主键',
`thumb` varchar(200) DEFAULT NULL COMMENT '缩略图',
`image` varchar(200) DEFAULT NULL COMMENT '原图',
`sort` int(11) DEFAULT '0' COMMENT '相册组',
`name` varchar(200) DEFAULT NULL COMMENT '图片名称',
`description` varchar(200) DEFAULT NULL COMMENT '图片描述',
`order` int(10) unsigned DEFAULT '0' COMMENT '图片排序',
PRIMARY KEY (`gid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for links
-- ----------------------------
DROP TABLE IF EXISTS `links`;
CREATE TABLE `links` (
`lid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'links表主键',
`name` varchar(200) DEFAULT NULL COMMENT 'links名称',
`url` varchar(200) DEFAULT NULL COMMENT 'links网址',
`sort` varchar(200) DEFAULT NULL COMMENT 'links分类',
`image` varchar(200) DEFAULT NULL COMMENT 'links图片',
`description` varchar(200) DEFAULT NULL COMMENT 'links描述',
`user` varchar(200) DEFAULT NULL COMMENT '自定义',
`order` int(10) unsigned DEFAULT '0' COMMENT 'links排序',
PRIMARY KEY (`lid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for metas
-- ----------------------------
DROP TABLE IF EXISTS `metas`;
CREATE TABLE `metas` (
`mid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(200) DEFAULT NULL,
`slug` varchar(200) DEFAULT NULL,
`type` varchar(32) NOT NULL,
`description` varchar(200) DEFAULT NULL,
`count` int(10) unsigned DEFAULT '0',
`order` int(10) unsigned DEFAULT '0',
`parent` int(10) unsigned DEFAULT '0',
PRIMARY KEY (`mid`),
UNIQUE KEY `metas_pk` (`slug`,`type`),
KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=71 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for options
-- ----------------------------
DROP TABLE IF EXISTS `options`;
CREATE TABLE `options` (
`name` varchar(32) NOT NULL,
`value` int(11) NOT NULL,
PRIMARY KEY (`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for posts
-- ----------------------------
DROP TABLE IF EXISTS `posts`;
CREATE TABLE `posts` (
`cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned DEFAULT '1',
`title` varchar(200) DEFAULT NULL,
`slug` varchar(200) DEFAULT NULL,
`created` int(10) unsigned DEFAULT '0',
`modified` int(10) unsigned DEFAULT '0',
`text` longtext,
`order` int(10) unsigned DEFAULT '0',
`type` varchar(16) DEFAULT 'post',
`status` varchar(16) DEFAULT 'publish',
`password` varchar(32) DEFAULT NULL,
`commentsNum` int(10) unsigned DEFAULT '0',
`allowComment` char(1) DEFAULT '0',
`parent` int(10) unsigned DEFAULT '0',
`viewsNum` int(11) DEFAULT '0',
`likesNum` int(11) DEFAULT '0',
PRIMARY KEY (`cid`),
UNIQUE KEY `slug` (`slug`),
UNIQUE KEY `unique-slug` (`slug`) USING BTREE,
KEY `created` (`created`),
KEY `posts_users_uid_fk` (`uid`),
CONSTRAINT `posts_users_uid_fk` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=293 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for relationships
-- ----------------------------
DROP TABLE IF EXISTS `relationships`;
CREATE TABLE `relationships` (
`cid` int(10) unsigned NOT NULL,
`mid` int(10) unsigned NOT NULL,
PRIMARY KEY (`cid`,`mid`),
KEY `cid` (`cid`),
KEY `mid` (`mid`),
CONSTRAINT `cid` FOREIGN KEY (`cid`) REFERENCES `posts` (`cid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `mid` FOREIGN KEY (`mid`) REFERENCES `metas` (`mid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`uid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(32) DEFAULT NULL,
`password` varchar(64) DEFAULT NULL,
`email` varchar(200) DEFAULT NULL,
`url` varchar(200) DEFAULT NULL,
`nickname` varchar(32) DEFAULT NULL,
`created` int(10) unsigned DEFAULT '0',
`activated` int(10) unsigned DEFAULT '0',
`logged` int(10) unsigned DEFAULT '0',
`group` varchar(16) DEFAULT 'visitor',
`authCode` varchar(64) DEFAULT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `name` (`username`),
UNIQUE KEY `mail` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;