X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2Fmssql%2Ftables.sql;h=3babb393fb6b45c84f79ad12a2af649eac637b68;hp=256ee364d6c3d948273f1b9428ce5daaee1193e1;hb=c584722cc2e3d33edae58d46c2149063b3fc6d72;hpb=dcdb8e463e3b2be121c61c91df13ea36d270a602 diff --git a/maintenance/mssql/tables.sql b/maintenance/mssql/tables.sql index 256ee364d6..3babb393fb 100644 --- a/maintenance/mssql/tables.sql +++ b/maintenance/mssql/tables.sql @@ -64,9 +64,11 @@ INSERT INTO /*_*/mwuser (user_name) VALUES ('##Anonymous##'); CREATE TABLE /*_*/user_groups ( ug_user INT NOT NULL REFERENCES /*_*/mwuser(user_id) ON DELETE CASCADE, ug_group NVARCHAR(255) NOT NULL DEFAULT '', + ug_expiry varchar(14) DEFAULT NULL, + PRIMARY KEY(ug_user, ug_group) ); -CREATE UNIQUE clustered INDEX /*i*/ug_user_group ON /*_*/user_groups (ug_user, ug_group); CREATE INDEX /*i*/ug_group ON /*_*/user_groups(ug_group); +CREATE INDEX /*i*/ug_expiry ON /*_*/user_groups(ug_expiry); -- Stores the groups the user has once belonged to. -- The user may still belong to these groups (check user_groups). @@ -299,7 +301,7 @@ CREATE TABLE /*_*/categorylinks ( -- conversion algorithm is run. We store this so that we can update -- collations without reparsing all pages. -- Note: If you change the length of this field, you also need to change - -- code in LinksUpdate.php. See bug 25254. + -- code in LinksUpdate.php. See T27254. cl_sortkey_prefix varbinary(255) NOT NULL default 0x, -- This isn't really used at present. Provided for an optional @@ -389,11 +391,18 @@ CREATE TABLE /*_*/externallinks ( -- which allows for fast searching for all pages under example.com with the -- clause: -- WHERE el_index LIKE 'http://com.example.%' - el_index nvarchar(450) NOT NULL + el_index nvarchar(450) NOT NULL, + + -- This is el_index truncated to 60 bytes to allow for sortable queries that + -- aren't supported by a partial index. + -- @todo Drop the default once this is deployed everywhere and code is populating it. + el_index_60 varbinary(60) NOT NULL default '' ); CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from); CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index); +CREATE INDEX /*i*/el_index_60 ON /*_*/externallinks (el_index_60, el_id); +CREATE INDEX /*i*/el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id); -- el_to index intentionally not added; we cannot index nvarchar(max) columns, -- but we also cannot restrict el_to to a smaller column size as the external -- link may be larger. @@ -519,7 +528,7 @@ CREATE TABLE /*_*/ipblocks ( -- Size chosen to allow IPv6 -- FIXME: these fields were originally blank for single-IP blocks, -- but now they are populated. No migration was ever done. They - -- should be fixed to be blank again for such blocks (bug 49504). + -- should be fixed to be blank again for such blocks (T51504). ipb_range_start varchar(255) NOT NULL, ipb_range_end varchar(255) NOT NULL, @@ -652,7 +661,6 @@ CREATE TABLE /*_*/oldimage ( CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); -CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name); CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1);