-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLupdates
73 lines (56 loc) · 2.4 KB
/
SQLupdates
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
alter table comment add reply_to_comment_id int(11) default 0;
alter table homepage drop foreign key FK_ID;
######################################
use xichao;
alter table homepage add column recommend_words varchar(255) not null default "I like it";
######################################
CREATE TABLE pay_record (
pay_record_id INTEGER NOT NULL AUTO_INCREMENT,
coins INTEGER NOT NULL,
user_id INTEGER,
article_id INTEGER,
PRIMARY KEY (pay_record_id),
FOREIGN KEY(user_id) REFERENCES user (user_id),
FOREIGN KEY(article_id) REFERENCES article (article_id)
)ENGINE=InnoDB CHARSET=utf8
DROP TABLE `xichao`.`pay_record`;
CREATE TABLE pay_record (
pay_record_id INTEGER NOT NULL AUTO_INCREMENT,
coins INTEGER NOT NULL,
time DATETIME NOT NULL,
user_id INTEGER,
article_id INTEGER,
PRIMARY KEY (pay_record_id),
FOREIGN KEY(user_id) REFERENCES user (user_id),
FOREIGN KEY(article_id) REFERENCES article (article_id)
)ENGINE=InnoDB CHARSET=utf8
######################################
use xichao;
alter table book modify column author varchar(255);
alter table homepage add ground_recommended_article int(11) not null default 1;
alter table homepage add constraint FK_ID foreign key(ground_recommended_article) references article(article_id);
alter table message add is_read char(1) not null default '0';
create index is_read on message(is_read);
alter table comment add is_read char(1) not null default '0';
create index is_read on comment(is_read);
alter table user add cover varchar(255) not null default '/upload/cover/default.jpg';
alter table homepage add column recommended_activity int(11) not null default 1;
alter table homepage add recommended_activity int(11) not null default 1;
alter table homepage add constraint FK_ID foreign key(recommended_activity) references activity(activity_id);
CREATE TABLE special_author (
special_author_id INTEGER NOT NULL AUTO_INCREMENT,
time DATETIME NOT NULL,
user_id INTEGER,
special_id INTEGER,
PRIMARY KEY (special_author_id),
FOREIGN KEY(user_id) REFERENCES user (user_id),
FOREIGN KEY(special_id) REFERENCES special (special_id)
)ENGINE=InnoDB CHARSET=utf8
CREATE TABLE special_related (
special_related_id INTEGER NOT NULL AUTO_INCREMENT,
host_id INTEGER,
guest_id INTEGER,
PRIMARY KEY (special_related_id),
FOREIGN KEY(host_id) REFERENCES special (special_id),
FOREIGN KEY(guest_id) REFERENCES special (special_id)
)ENGINE=InnoDB CHARSET=utf8