X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2Ftables.sql;h=1497d6fc239c5faa3d0794029df0f3bf170a1382;hp=14f69324f775f2ddade7a70018913c823c3577e4;hb=d779a09035c43785e544279b93242a01960f6c72;hpb=c61c1ac00079c654a0e1a68bf5c25c1f5bef031a diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 14f69324f7..1497d6fc23 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -410,6 +410,30 @@ CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timesta -- and is a logged-in user. CREATE INDEX /*i*/page_user_timestamp ON /*_*/revision (rev_page,rev_user,rev_timestamp); +-- +-- Every time an edit by a logged out user is saved, +-- a row is created in ip_changes. This stores +-- the IP as a hex representation so that we can more +-- easily find edits within an IP range. +-- +CREATE TABLE /*_*/ip_changes ( + -- Foreign key to the revision table, also serves as the unique primary key + ipc_rev_id int unsigned NOT NULL PRIMARY KEY DEFAULT '0', + + -- The timestamp of the revision + ipc_rev_timestamp binary(14) NOT NULL DEFAULT '', + + -- Hex representation of the IP address, as returned by IP::toHex() + -- For IPv4 it will resemble: ABCD1234 + -- For IPv6: v6-ABCD1234000000000000000000000000 + -- BETWEEN is then used to identify revisions within a given range + ipc_hex varbinary(35) NOT NULL DEFAULT '' + +) /*$wgDBTableOptions*/; + +CREATE INDEX /*i*/ipc_rev_timestamp ON /*_*/ip_changes (ipc_rev_timestamp); +CREATE INDEX /*i*/ipc_hex_time ON /*_*/ip_changes (ipc_hex,ipc_rev_timestamp); + -- -- Holds text of individual page revisions. --