Merge "Rewrite pref cleanup script"
[lhc/web/wiklou.git] / maintenance / archives / patch-ip_changes.sql
1 --
2 -- Every time an edit by a logged out user is saved,
3 -- a row is created in ip_changes. This stores
4 -- the IP as a hex representation so that we can more
5 -- easily find edits within an IP range.
6 --
7 CREATE TABLE /*_*/ip_changes (
8 -- Foreign key to the revision table, also serves as the unique primary key
9 ipc_rev_id int unsigned NOT NULL PRIMARY KEY DEFAULT '0',
10
11 -- The timestamp of the revision
12 ipc_rev_timestamp binary(14) NOT NULL DEFAULT '',
13
14 -- Hex representation of the IP address, as returned by IP::toHex()
15 -- For IPv4 it will resemble: ABCD1234
16 -- For IPv6: v6-ABCD1234000000000000000000000000
17 -- BETWEEN is then used to identify revisions within a given range
18 ipc_hex varbinary(35) NOT NULL DEFAULT ''
19
20 ) /*$wgDBTableOptions*/;
21
22 CREATE INDEX /*i*/ipc_rev_timestamp ON /*_*/ip_changes (ipc_rev_timestamp);
23 CREATE INDEX /*i*/ipc_hex_time ON /*_*/ip_changes (ipc_hex,ipc_rev_timestamp);