2 -- patch-actor-table.sql
4 -- T167246. Add an `actor` table and various columns (and temporary tables) to reference it.
6 CREATE TABLE /*_*/actor (
7 actor_id
bigint unsigned
NOT NULL PRIMARY KEY AUTO_INCREMENT
,
8 actor_user
int unsigned
,
9 actor_name
varchar(255) binary NOT NULL
10 ) /*$wgDBTableOptions*/;
11 CREATE UNIQUE INDEX /*i*/actor_user
ON /*_*/actor (actor_user
);
12 CREATE UNIQUE INDEX /*i*/actor_name
ON /*_*/actor (actor_name
);
14 CREATE TABLE /*_*/revision_actor_temp (
15 revactor_rev
int unsigned
NOT NULL,
16 revactor_actor
bigint unsigned
NOT NULL,
17 revactor_timestamp
binary(14) NOT NULL default '',
18 revactor_page
int unsigned
NOT NULL,
19 PRIMARY KEY (revactor_rev
, revactor_actor
)
20 ) /*$wgDBTableOptions*/;
21 CREATE UNIQUE INDEX /*i*/revactor_rev
ON /*_*/revision_actor_temp (revactor_rev
);
22 CREATE INDEX /*i*/actor_timestamp
ON /*_*/revision_actor_temp (revactor_actor
,revactor_timestamp
);
23 CREATE INDEX /*i*/page_actor_timestamp
ON /*_*/revision_actor_temp (revactor_page
,revactor_actor
,revactor_timestamp
);
25 ALTER TABLE /*_*/archive
26 ALTER COLUMN ar_user_text
SET DEFAULT '',
27 ADD COLUMN ar_actor
bigint unsigned
NOT NULL DEFAULT 0 AFTER ar_user_text
;
28 CREATE INDEX /*i*/ar_actor_timestamp
ON /*_*/archive (ar_actor
,ar_timestamp
);
30 ALTER TABLE /*_*/ipblocks
31 ADD COLUMN ipb_by_actor
bigint unsigned
NOT NULL DEFAULT 0 AFTER ipb_by_text
;
33 ALTER TABLE /*_*/image
34 ALTER COLUMN img_user_text
SET DEFAULT '',
35 ADD COLUMN img_actor
bigint unsigned
NOT NULL DEFAULT 0 AFTER img_user_text
;
36 CREATE INDEX /*i*/img_actor_timestamp
ON /*_*/image (img_actor
, img_timestamp
);
38 ALTER TABLE /*_*/oldimage
39 ALTER COLUMN oi_user_text
SET DEFAULT '',
40 ADD COLUMN oi_actor
bigint unsigned
NOT NULL DEFAULT 0 AFTER oi_user_text
;
41 CREATE INDEX /*i*/oi_actor_timestamp
ON /*_*/oldimage (oi_actor
,oi_timestamp
);
43 ALTER TABLE /*_*/filearchive
44 ALTER COLUMN fa_user_text
SET DEFAULT '',
45 ADD COLUMN fa_actor
bigint unsigned
NOT NULL DEFAULT 0 AFTER fa_user_text
;
46 CREATE INDEX /*i*/fa_actor_timestamp
ON /*_*/filearchive (fa_actor
,fa_timestamp
);
48 ALTER TABLE /*_*/recentchanges
49 ALTER COLUMN rc_user_text
SET DEFAULT '',
50 ADD COLUMN rc_actor
bigint unsigned
NOT NULL DEFAULT 0 AFTER rc_user_text
;
51 CREATE INDEX /*i*/rc_ns_actor
ON /*_*/recentchanges (rc_namespace
, rc_actor
);
52 CREATE INDEX /*i*/rc_actor
ON /*_*/recentchanges (rc_actor
, rc_timestamp
);
54 ALTER TABLE /*_*/logging
55 ADD COLUMN log_actor
bigint unsigned
NOT NULL DEFAULT 0 AFTER log_user_text
;
56 CREATE INDEX /*i*/actor_time
ON /*_*/logging (log_actor
, log_timestamp
);
57 CREATE INDEX /*i*/log_actor_type_time
ON /*_*/logging (log_actor
, log_type
, log_timestamp
);