r20302 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20301‎ | r20302 | r20303 >
Date:21:51, 9 March 2007
Author:aaron
Status:old
Tags:
Comment:
*Add bitfields to various tables for revisiondelete
Modified paths:
  • /branches/phase3_rev_deleted/maintenance/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/archives/patch-ar_deleted.sql (added) (history)
  • /trunk/phase3/maintenance/archives/patch-fa_deleted.sql (added) (history)
  • /trunk/phase3/maintenance/archives/patch-ipb_deleted.sql (added) (history)
  • /trunk/phase3/maintenance/archives/patch-log_deleted.sql (added) (history)
  • /trunk/phase3/maintenance/archives/patch-rc_deleted.sql (added) (history)
  • /trunk/phase3/maintenance/mysql5/tables-binary.sql (modified) (history)
  • /trunk/phase3/maintenance/mysql5/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/postgres/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/archives/patch-log_deleted.sql
@@ -0,0 +1,3 @@
 2+-- Adding ar_deleted field for revisiondelete
 3+ALTER TABLE /*$wgDBprefix*/logging
 4+ ADD log_deleted tinyint(1) unsigned NOT NULL default '0';
\ No newline at end of file
Index: trunk/phase3/maintenance/archives/patch-ar_deleted.sql
@@ -0,0 +1,3 @@
 2+-- Adding ar_deleted field for revisiondelete
 3+ALTER TABLE /*$wgDBprefix*/archive
 4+ ADD ar_deleted tinyint(1) unsigned NOT NULL default '0';
\ No newline at end of file
Index: trunk/phase3/maintenance/archives/patch-fa_deleted.sql
@@ -0,0 +1,3 @@
 2+-- Adding fa_deleted field for additional content suppression
 3+ALTER TABLE /*$wgDBprefix*/filearchive
 4+ ADD fa_deleted tinyint(1) unsigned NOT NULL default '0';
\ No newline at end of file
Index: trunk/phase3/maintenance/archives/patch-rc_deleted.sql
@@ -0,0 +1,8 @@
 2+-- Adding rc_deleted field for revisiondelete
 3+-- Add rc_logid to match log_id
 4+ALTER TABLE /*$wgDBprefix*/recentchanges
 5+ ADD rc_deleted tinyint(1) unsigned NOT NULL default '0',
 6+ ADD rc_logid int(10) unsigned NOT NULL default '0',
 7+ ADD rc_log_type varchar(255) binary NULL default NULL,
 8+ ADD rc_log_action varchar(255) binary NULL default NULL,
 9+ ADD rc_params blob NOT NULL default '',
\ No newline at end of file
Index: trunk/phase3/maintenance/archives/patch-ipb_deleted.sql
@@ -0,0 +1,3 @@
 2+-- Adding ipb_deleted field for hiding usernames
 3+ALTER TABLE /*$wgDBprefix*/ipblocks
 4+ ADD ipb_deleted bool NOT NULL default 0;
\ No newline at end of file
Index: trunk/phase3/maintenance/postgres/tables.sql
@@ -113,7 +113,7 @@
114114
115115 CREATE SEQUENCE pr_id_val;
116116 CREATE TABLE page_restrictions (
117 - pr_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('pr_id_val'),
 117+ pr_id INTEGER NOT NULL UNIQUE DEFAULT nextval('pr_id_val'),
118118 pr_page INTEGER NULL REFERENCES page (page_id) ON DELETE CASCADE,
119119 pr_type TEXT NOT NULL,
120120 pr_level TEXT NOT NULL,
@@ -135,7 +135,8 @@
136136 ar_minor_edit CHAR NOT NULL DEFAULT '0',
137137 ar_flags TEXT,
138138 ar_rev_id INTEGER,
139 - ar_text_id INTEGER
 139+ ar_text_id INTEGER,
 140+ ar_deleted INTEGER NOT NULL DEFAULT '0',
140141 );
141142 CREATE INDEX archive_name_title_timestamp ON archive2 (ar_namespace,ar_title,ar_timestamp);
142143
@@ -246,6 +247,7 @@
247248 ipb_expiry TIMESTAMPTZ NOT NULL,
248249 ipb_range_start TEXT,
249250 ipb_range_end TEXT
 251+ ipb_deleted INTEGER NOT NULL, DEFAULT '0',
250252 );
251253 CREATE INDEX ipb_address ON ipblocks (ipb_address);
252254 CREATE INDEX ipb_user ON ipblocks (ipb_user);
@@ -306,6 +308,7 @@
307309 fa_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE SET NULL,
308310 fa_user_text TEXT NOT NULL,
309311 fa_timestamp TIMESTAMPTZ
 312+ fa_deleted INTEGER NOT NULL DEFAULT '0',
310313 );
311314 CREATE INDEX fa_name_time ON filearchive (fa_name, fa_timestamp);
312315 CREATE INDEX fa_dupe ON filearchive (fa_storage_group, fa_storage_key);
@@ -335,7 +338,12 @@
336339 rc_patrolled CHAR NOT NULL DEFAULT '0',
337340 rc_ip CIDR,
338341 rc_old_len INTEGER,
339 - rc_new_len INTEGER
 342+ rc_new_len INTEGER,
 343+ rc_deleted INTEGER NOT NULL DEFAULT '0',
 344+ rc_logid INTEGER NOT NULL DEFAULT '0',
 345+ rc_log_type TEXT,
 346+ rc_log_action TEXT,
 347+ rc_params TEXT,
340348 );
341349 CREATE INDEX rc_timestamp ON recentchanges (rc_timestamp);
342350 CREATE INDEX rc_namespace_title ON recentchanges (rc_namespace, rc_title);
@@ -410,6 +418,7 @@
411419 );
412420
413421
 422+CREATE SEQUENCE log_log_id_seq;
414423 CREATE TABLE logging (
415424 log_type TEXT NOT NULL,
416425 log_action TEXT NOT NULL,
@@ -418,7 +427,9 @@
419428 log_namespace SMALLINT NOT NULL,
420429 log_title TEXT NOT NULL,
421430 log_comment TEXT,
422 - log_params TEXT
 431+ log_params TEXT,
 432+ log_deleted INTEGER NOT NULL DEFAULT '0',
 433+ log_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('log_log_id_seq'),
423434 );
424435 CREATE INDEX logging_type_name ON logging (log_type, log_timestamp);
425436 CREATE INDEX logging_user_time ON logging (log_timestamp, log_user);
Index: trunk/phase3/maintenance/updaters.inc
@@ -63,10 +63,15 @@
6464 array( 'ipblocks', 'ipb_range_start', 'patch-ipb_range_start.sql' ),
6565 array( 'site_stats', 'ss_images', 'patch-ss_images.sql' ),
6666 array( 'ipblocks', 'ipb_anon_only', 'patch-ipb_anon_only.sql' ),
67 - array( 'ipblocks', 'ipb_enable_autoblock', 'patch-ipb_optional_autoblock.sql' ),
 67+ array( 'ipblocks', 'ipb_enable_autoblock', 'patch-ipb_optional_autoblock.sql' ),
6868 array( 'user', 'user_newpass_time','patch-user_newpass_time.sql' ),
6969 array( 'user', 'user_editcount', 'patch-user_editcount.sql' ),
70 - array( 'logging', 'log_id', 'patch-log_id.sql' ),
 70+ array( 'recentchanges', 'rc_deleted', 'patch-rc_deleted.sql' ),
 71+ array( 'logging', 'log_id', 'patch-log_id.sql' ),
 72+ array( 'logging', 'log_deleted', 'patch-log_deleted.sql' ),
 73+ array( 'archive', 'ar_deleted', 'patch-ar_deleted.sql' ),
 74+ array( 'ipblocks', 'ipb_deleted', 'patch-ipb_deleted.sql' ),
 75+ array( 'filearchive', 'fa_deleted', 'patch-fa_deleted.sql' ),
7176 array( 'page_restrictions', 'pr_id', 'patch-page_restrictions_sortkey.sql' ),
7277 array( 'revision', 'rev_len', 'patch-rev_len.sql' ),
7378 array( 'revision', 'rev_parent_id', 'patch-rev_parent_id.sql' ),
Index: trunk/phase3/maintenance/mysql5/tables.sql
@@ -383,6 +383,9 @@
384384 -- row upon undeletion.
385385 ar_text_id int(8) unsigned,
386386
 387+ -- rev_deleted for archives
 388+ ar_deleted tinyint(1) unsigned NOT NULL default '0',
 389+
387390 KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp)
388391
389392 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
@@ -625,6 +628,8 @@
626629 -- Size chosen to allow IPv6
627630 ipb_range_start tinyblob NOT NULL,
628631 ipb_range_end tinyblob NOT NULL,
 632+ -- Flag for entries hidden from users and Sysops
 633+ ipb_deleted bool NOT NULL default 0,
629634
630635 PRIMARY KEY ipb_id (ipb_id),
631636
@@ -753,6 +758,9 @@
754759 fa_deleted_timestamp char(14) binary default '',
755760 fa_deleted_reason text,
756761
 762+ -- Visibility of deleted revisions, bitfield
 763+ fa_deleted tinyint(1) unsigned NOT NULL default '0',
 764+
757765 -- Duped fields from image
758766 fa_size int(8) unsigned default '0',
759767 fa_width int(5) default '0',
@@ -829,12 +837,24 @@
830838 -- Recorded IP address the edit was made from, if the
831839 -- $wgPutIPinRC option is enabled.
832840 rc_ip char(15) NOT NULL default '',
833 -
 841+
834842 -- Text length in characters before
835843 -- and after the edit
836844 rc_old_len int(10),
837845 rc_new_len int(10),
838846
 847+ -- Visibility of deleted revisions, bitfield
 848+ rc_deleted tinyint(1) unsigned NOT NULL default '0',
 849+
 850+ -- Value corresonding to log_id, specific log entries
 851+ rc_logid int(10) unsigned NOT NULL default '0',
 852+ -- Store log type info here, or null
 853+ rc_log_type varchar(255) binary NULL default NULL,
 854+ -- Store log action or null
 855+ rc_log_action varchar(255) binary NULL default NULL,
 856+ -- Log params
 857+ rc_params blob NOT NULL default '',
 858+
839859 PRIMARY KEY rc_id (rc_id),
840860 INDEX rc_timestamp (rc_timestamp),
841861 INDEX rc_namespace_title (rc_namespace, rc_title),
@@ -1006,6 +1026,9 @@
10071027 KEY user_time (log_user, log_timestamp),
10081028 KEY page_time (log_namespace, log_title, log_timestamp),
10091029 KEY times (log_timestamp)
 1030+
 1031+ -- rev_deleted for logs
 1032+ log_deleted tinyint(1) unsigned NOT NULL default '0',
10101033
10111034 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
10121035
Index: trunk/phase3/maintenance/mysql5/tables-binary.sql
@@ -392,6 +392,9 @@
393393 -- row upon undeletion.
394394 ar_text_id int(8) unsigned,
395395
 396+ -- rev_deleted for archives
 397+ ar_deleted tinyint(1) unsigned NOT NULL default '0',
 398+
396399 KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp)
397400
398401 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
@@ -634,6 +637,8 @@
635638 -- Size chosen to allow IPv6
636639 ipb_range_start tinyblob NOT NULL,
637640 ipb_range_end tinyblob NOT NULL,
 641+ -- Flag for entries hidden from users and Sysops
 642+ ipb_deleted bool NOT NULL default 0,
638643
639644 PRIMARY KEY ipb_id (ipb_id),
640645
@@ -776,6 +781,9 @@
777782 fa_user_text varchar(255) binary,
778783 fa_timestamp char(14) binary default '',
779784
 785+ -- Visibility of deleted revisions, bitfield
 786+ fa_deleted tinyint(1) unsigned NOT NULL default '0',
 787+
780788 PRIMARY KEY (fa_id),
781789 INDEX (fa_name, fa_timestamp), -- pick out by image name
782790 INDEX (fa_storage_group, fa_storage_key), -- pick out dupe files
@@ -844,6 +852,18 @@
845853 rc_old_len int(10),
846854 rc_new_len int(10),
847855
 856+ -- Visibility of deleted revisions, bitfield
 857+ rc_deleted tinyint(1) unsigned NOT NULL default '0',
 858+
 859+ -- Value corresonding to log_id, specific log entries
 860+ rc_logid int(10) unsigned NOT NULL default '0',
 861+ -- Store log type info here, or null
 862+ rc_log_type varchar(255) binary NULL default NULL,
 863+ -- Store log action or null
 864+ rc_log_action varchar(255) binary NULL default NULL,
 865+ -- Log params
 866+ rc_params blob NOT NULL default '',
 867+
848868 PRIMARY KEY rc_id (rc_id),
849869 INDEX rc_timestamp (rc_timestamp),
850870 INDEX rc_namespace_title (rc_namespace, rc_title),
@@ -1010,6 +1030,9 @@
10111031
10121032 -- LF separated list of miscellaneous parameters
10131033 log_params blob NOT NULL,
 1034+
 1035+ -- rev_deleted for logs
 1036+ log_deleted tinyint(1) unsigned NOT NULL default '0',
10141037
10151038 KEY type_time (log_type, log_timestamp),
10161039 KEY user_time (log_user, log_timestamp),
Index: branches/phase3_rev_deleted/maintenance/tables.sql
@@ -813,8 +813,10 @@
814814 rc_logid int(10) unsigned NOT NULL default '0',
815815 -- Store log type info here, or null
816816 rc_log_type varchar(255) binary NULL default NULL,
817 - -- The action text of logs
818 - rc_actiontext varchar(255) binary NULL default NULL,
 817+ -- Store log action or null
 818+ rc_log_action varchar(255) binary NULL default NULL,
 819+ -- Log params
 820+ rc_params blob NOT NULL default '',
819821
820822 PRIMARY KEY rc_id (rc_id),
821823 INDEX rc_timestamp (rc_timestamp),

Follow-up revisions

RevisionCommit summaryAuthorDate
r20310*Revert r20302, no use for this indexaaron18:19, 10 March 2007
r20311postgres updaters for r20302river18:41, 10 March 2007