Merge "Show a warning in edit preview when a template loop is detected"
[lhc/web/wiklou.git] / maintenance / archives / patch-comment-table.sql
1 --
2 -- patch-comment-table.sql
3 --
4 -- T166732. Add a `comment` table and various columns (and temporary tables) to reference it.
5
6 CREATE TABLE /*_*/comment (
7 comment_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
8 comment_hash INT NOT NULL,
9 comment_text BLOB NOT NULL,
10 comment_data BLOB
11 ) /*$wgDBTableOptions*/;
12 CREATE INDEX /*i*/comment_hash ON /*_*/comment (comment_hash);
13
14 CREATE TABLE /*_*/revision_comment_temp (
15 revcomment_rev int unsigned NOT NULL,
16 revcomment_comment_id bigint unsigned NOT NULL,
17 PRIMARY KEY (revcomment_rev, revcomment_comment_id)
18 ) /*$wgDBTableOptions*/;
19 CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
20
21 CREATE TABLE /*_*/image_comment_temp (
22 imgcomment_name varchar(255) binary NOT NULL,
23 imgcomment_description_id bigint unsigned NOT NULL,
24 PRIMARY KEY (imgcomment_name, imgcomment_description_id)
25 ) /*$wgDBTableOptions*/;
26 CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name);
27
28 ALTER TABLE /*_*/revision
29 ALTER COLUMN rev_comment SET DEFAULT '';
30
31 ALTER TABLE /*_*/archive
32 ALTER COLUMN ar_comment SET DEFAULT '',
33 ADD COLUMN ar_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER ar_comment;
34
35 ALTER TABLE /*_*/ipblocks
36 ALTER COLUMN ipb_reason SET DEFAULT '',
37 ADD COLUMN ipb_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER ipb_reason;
38
39 ALTER TABLE /*_*/image
40 ALTER COLUMN img_description SET DEFAULT '';
41
42 ALTER TABLE /*_*/oldimage
43 ALTER COLUMN oi_description SET DEFAULT '',
44 ADD COLUMN oi_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER oi_description;
45
46 ALTER TABLE /*_*/filearchive
47 ADD COLUMN fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_deleted_reason,
48 ALTER COLUMN fa_description SET DEFAULT '',
49 ADD COLUMN fa_description_id bigint unsigned NOT NULL DEFAULT 0 AFTER fa_description;
50
51 ALTER TABLE /*_*/recentchanges
52 ADD COLUMN rc_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER rc_comment;
53
54 ALTER TABLE /*_*/logging
55 ADD COLUMN log_comment_id bigint unsigned NOT NULL DEFAULT 0 AFTER log_comment;
56
57 ALTER TABLE /*_*/protected_titles
58 ALTER COLUMN pt_reason SET DEFAULT '',
59 ADD COLUMN pt_reason_id bigint unsigned NOT NULL DEFAULT 0 AFTER pt_reason;