-
Notifications
You must be signed in to change notification settings - Fork 3
/
blog.sql
309 lines (262 loc) · 7.86 KB
/
blog.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
-- phpMyAdmin SQL Dump
-- version 4.4.15.10
-- https://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: 2024-09-30 18:21:45
-- 服务器版本: 5.7.34-log
-- PHP Version: 5.6.40
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `blog-dev`
--
-- --------------------------------------------------------
--
-- 表的结构 `comments`
--
CREATE TABLE IF NOT EXISTS `comments` (
`coid` int(10) unsigned NOT NULL,
`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',
`mail` 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',
`authorImg` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `fields`
--
CREATE TABLE IF NOT EXISTS `fields` (
`cid` int(10) unsigned NOT NULL,
`name` varchar(200) NOT NULL,
`type` varchar(8) DEFAULT 'str',
`str_value` text,
`int_value` int(11) DEFAULT '0',
`float_value` float DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `gallery`
--
CREATE TABLE IF NOT EXISTS `gallery` (
`gid` int(10) unsigned NOT NULL 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 '图片排序'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `links`
--
CREATE TABLE IF NOT EXISTS `links` (
`lid` int(10) unsigned NOT NULL 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排序'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `metas`
--
CREATE TABLE IF NOT EXISTS `metas` (
`mid` int(10) unsigned NOT NULL,
`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'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `options`
--
CREATE TABLE IF NOT EXISTS `options` (
`name` varchar(32) NOT NULL,
`value` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `posts`
--
CREATE TABLE IF NOT EXISTS `posts` (
`cid` int(10) unsigned NOT NULL,
`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'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `relationships`
--
CREATE TABLE IF NOT EXISTS `relationships` (
`cid` int(10) unsigned NOT NULL,
`mid` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`uid` int(10) unsigned NOT NULL,
`username` varchar(32) DEFAULT NULL,
`password` varchar(64) DEFAULT NULL,
`mail` varchar(200) DEFAULT NULL,
`url` varchar(200) DEFAULT NULL,
`screenName` 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
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`coid`),
ADD KEY `cid` (`cid`),
ADD KEY `created` (`created`);
--
-- Indexes for table `fields`
--
ALTER TABLE `fields`
ADD PRIMARY KEY (`cid`,`name`),
ADD KEY `int_value` (`int_value`),
ADD KEY `float_value` (`float_value`);
--
-- Indexes for table `gallery`
--
ALTER TABLE `gallery`
ADD PRIMARY KEY (`gid`);
--
-- Indexes for table `links`
--
ALTER TABLE `links`
ADD PRIMARY KEY (`lid`);
--
-- Indexes for table `metas`
--
ALTER TABLE `metas`
ADD PRIMARY KEY (`mid`),
ADD KEY `slug` (`slug`);
--
-- Indexes for table `options`
--
ALTER TABLE `options`
ADD PRIMARY KEY (`name`) USING BTREE;
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`cid`),
ADD UNIQUE KEY `slug` (`slug`),
ADD UNIQUE KEY `unique-slug` (`slug`) USING BTREE,
ADD KEY `created` (`created`),
ADD KEY `posts_users_uid_fk` (`uid`);
--
-- Indexes for table `relationships`
--
ALTER TABLE `relationships`
ADD PRIMARY KEY (`cid`,`mid`),
ADD KEY `cid` (`cid`),
ADD KEY `mid` (`mid`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`uid`),
ADD UNIQUE KEY `name` (`username`),
ADD UNIQUE KEY `mail` (`mail`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
MODIFY `coid` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `gallery`
--
ALTER TABLE `gallery`
MODIFY `gid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'gallery表主键';
--
-- AUTO_INCREMENT for table `links`
--
ALTER TABLE `links`
MODIFY `lid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'links表主键';
--
-- AUTO_INCREMENT for table `metas`
--
ALTER TABLE `metas`
MODIFY `mid` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `cid` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `uid` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- 限制导出的表
--
--
-- 限制表 `comments`
--
ALTER TABLE `comments`
ADD CONSTRAINT `comments_posts_cid_fk` FOREIGN KEY (`cid`) REFERENCES `posts` (`cid`);
--
-- 限制表 `posts`
--
ALTER TABLE `posts`
ADD CONSTRAINT `posts_users_uid_fk` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`);
--
-- 限制表 `relationships`
--
ALTER TABLE `relationships`
ADD CONSTRAINT `cid` FOREIGN KEY (`cid`) REFERENCES `posts` (`cid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `mid` FOREIGN KEY (`mid`) REFERENCES `metas` (`mid`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;