-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathweibo.sql
193 lines (160 loc) · 7.07 KB
/
weibo.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
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
DROP SCHEMA IF EXISTS `weibo` ;
CREATE SCHEMA IF NOT EXISTS `weibo` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `weibo` ;
-- -----------------------------------------------------
-- Table `weibo`.`hd_user`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_user` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_user` (
`id` INT NOT NULL AUTO_INCREMENT ,
`account` CHAR(20) NOT NULL DEFAULT '' COMMENT '账号' ,
`password` CHAR(32) NOT NULL DEFAULT '' COMMENT '密码' ,
`registime` INT(10) UNSIGNED NOT NULL COMMENT '注册时间' ,
`lock` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否锁定(0:否,1:是)' ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `account` (`account` ASC) )
ENGINE = MyISAM
COMMENT = '用户表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_userinfo`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_userinfo` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_userinfo` (
`id` INT NOT NULL AUTO_INCREMENT ,
`username` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '用户昵称' ,
`truename` VARCHAR(45) NULL COMMENT '真实名称' ,
`sex` ENUM('男','女') NOT NULL DEFAULT '男' COMMENT '性别' ,
`location` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '所在地' ,
`constellation` CHAR(10) NOT NULL DEFAULT '' COMMENT '星座' ,
`intro` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '一句话介绍自己' ,
`face50` VARCHAR(60) NOT NULL DEFAULT '' COMMENT '50*50头像' ,
`face80` VARCHAR(60) NOT NULL DEFAULT '' COMMENT '80*80头像' ,
`face180` VARCHAR(60) NOT NULL DEFAULT '' COMMENT '180*180头像' ,
`style` VARCHAR(45) NOT NULL DEFAULT 'default' COMMENT '个性模版' ,
`follow` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '关注数' ,
`fans` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '粉丝数' ,
`weibo` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '微博数' ,
`uid` INT NOT NULL COMMENT '所属用户ID' ,
PRIMARY KEY (`id`) ,
INDEX `uid` (`uid` ASC) )
ENGINE = MyISAM
COMMENT = '用户信息表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_group`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_group` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_group` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '分组名称' ,
`uid` INT NOT NULL COMMENT '所属用户的ID' ,
PRIMARY KEY (`id`) ,
INDEX `uid` (`uid` ASC) )
ENGINE = MyISAM
COMMENT = '关注分组表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_follow`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_follow` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_follow` (
`follow` INT UNSIGNED NOT NULL COMMENT '关注用户的ID' ,
`fans` INT UNSIGNED NOT NULL COMMENT '粉丝用户ID' ,
`gid` INT NOT NULL COMMENT '所属关注分组ID' ,
INDEX `follow` (`follow` ASC) ,
INDEX `fans` (`fans` ASC) ,
INDEX `gid` (`gid` ASC) )
ENGINE = MyISAM
COMMENT = '关注与粉丝表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_letter`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_letter` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_letter` (
`id` INT NOT NULL AUTO_INCREMENT ,
`from` INT NOT NULL COMMENT '发私用户ID' ,
`content` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '私信内容' ,
`time` INT(10) UNSIGNED NOT NULL COMMENT '私信发送时间' ,
`uid` INT NOT NULL COMMENT '所属用户ID(收信人)' ,
PRIMARY KEY (`id`) ,
INDEX `uid` (`uid` ASC) )
ENGINE = MyISAM
COMMENT = '私信表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_weibo`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_weibo` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_weibo` (
`id` INT NOT NULL AUTO_INCREMENT ,
`content` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '微博内容' ,
`isturn` INT NOT NULL DEFAULT 0 COMMENT '是否转发(0:原创, 如果是转发的则保存该转发微博的ID)' ,
`time` INT(10) UNSIGNED NOT NULL COMMENT '发布时间' ,
`turn` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '转发次数' ,
`keep` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '收藏次数' ,
`comment` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '收藏次数' ,
`uid` INT NOT NULL COMMENT '所属用户的ID' ,
PRIMARY KEY (`id`) ,
INDEX `uid` (`uid` ASC) )
ENGINE = MyISAM
COMMENT = '微博表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_picture`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_picture` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_picture` (
`id` INT NOT NULL AUTO_INCREMENT ,
`mini` VARCHAR(60) NOT NULL DEFAULT '' COMMENT '小图' ,
`medium` VARCHAR(60) NOT NULL DEFAULT '' COMMENT '中图' ,
`max` VARCHAR(60) NOT NULL DEFAULT '' COMMENT '大图' ,
`wid` INT NOT NULL COMMENT '所属微博ID' ,
PRIMARY KEY (`id`) ,
INDEX `wid` (`wid` ASC) )
ENGINE = MyISAM
COMMENT = '微博配图表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_comment`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_comment` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_comment` (
`id` INT NOT NULL AUTO_INCREMENT ,
`content` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '评论内容' ,
`time` INT(10) UNSIGNED NOT NULL COMMENT '评论时间' ,
`uid` INT NOT NULL COMMENT '评论用户的ID' ,
`wid` INT NOT NULL COMMENT '所属微博ID' ,
PRIMARY KEY (`id`) ,
INDEX `uid` (`uid` ASC) ,
INDEX `wid` (`wid` ASC) )
ENGINE = MyISAM
COMMENT = '微博评论表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_keep`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_keep` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_keep` (
`id` INT NOT NULL AUTO_INCREMENT ,
`uid` INT NOT NULL COMMENT '收藏用户的ID' ,
`time` INT(10) UNSIGNED NOT NULL COMMENT '收藏时间' ,
`wid` INT NOT NULL COMMENT '收藏微博的ID' ,
PRIMARY KEY (`id`) ,
INDEX `wid` (`wid` ASC) ,
INDEX `uid` (`uid` ASC) )
ENGINE = MyISAM
COMMENT = '收藏表';
-- -----------------------------------------------------
-- Table `weibo`.`hd_atme`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `weibo`.`hd_atme` ;
CREATE TABLE IF NOT EXISTS `weibo`.`hd_atme` (
`id` INT NOT NULL AUTO_INCREMENT ,
`wid` INT NOT NULL COMMENT '提到我的微博ID' ,
`uid` INT NOT NULL COMMENT '所属用户ID' ,
PRIMARY KEY (`id`) ,
INDEX `uid` (`uid` ASC) ,
INDEX `wid` (`wid` ASC) )
ENGINE = MyISAM
COMMENT = '@提到我的微博';
USE `weibo` ;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;