*Add bitfields to various tables for revisiondelete
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 9 Mar 2007 21:51:11 +0000 (21:51 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 9 Mar 2007 21:51:11 +0000 (21:51 +0000)
maintenance/archives/patch-ar_deleted.sql [new file with mode: 0644]
maintenance/archives/patch-fa_deleted.sql [new file with mode: 0644]
maintenance/archives/patch-ipb_deleted.sql [new file with mode: 0644]
maintenance/archives/patch-log_deleted.sql [new file with mode: 0644]
maintenance/archives/patch-rc_deleted.sql [new file with mode: 0644]
maintenance/mysql5/tables-binary.sql
maintenance/mysql5/tables.sql
maintenance/postgres/tables.sql
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-ar_deleted.sql b/maintenance/archives/patch-ar_deleted.sql
new file mode 100644 (file)
index 0000000..8bf98eb
--- /dev/null
@@ -0,0 +1,3 @@
+-- Adding ar_deleted field for revisiondelete\r
+ALTER TABLE /*$wgDBprefix*/archive\r
+  ADD ar_deleted tinyint(1) unsigned NOT NULL default '0';
\ No newline at end of file
diff --git a/maintenance/archives/patch-fa_deleted.sql b/maintenance/archives/patch-fa_deleted.sql
new file mode 100644 (file)
index 0000000..a74bf47
--- /dev/null
@@ -0,0 +1,3 @@
+-- Adding fa_deleted field for additional content suppression\r
+ALTER TABLE /*$wgDBprefix*/filearchive \r
+  ADD fa_deleted tinyint(1) unsigned NOT NULL default '0';
\ No newline at end of file
diff --git a/maintenance/archives/patch-ipb_deleted.sql b/maintenance/archives/patch-ipb_deleted.sql
new file mode 100644 (file)
index 0000000..743f4d1
--- /dev/null
@@ -0,0 +1,3 @@
+-- Adding ipb_deleted field for hiding usernames\r
+ALTER TABLE /*$wgDBprefix*/ipblocks \r
+  ADD ipb_deleted bool NOT NULL default 0;
\ No newline at end of file
diff --git a/maintenance/archives/patch-log_deleted.sql b/maintenance/archives/patch-log_deleted.sql
new file mode 100644 (file)
index 0000000..a108144
--- /dev/null
@@ -0,0 +1,3 @@
+-- Adding ar_deleted field for revisiondelete\r
+ALTER TABLE /*$wgDBprefix*/logging\r
+  ADD log_deleted tinyint(1) unsigned NOT NULL default '0';
\ No newline at end of file
diff --git a/maintenance/archives/patch-rc_deleted.sql b/maintenance/archives/patch-rc_deleted.sql
new file mode 100644 (file)
index 0000000..dc1ee38
--- /dev/null
@@ -0,0 +1,8 @@
+-- Adding rc_deleted field for revisiondelete\r
+-- Add rc_logid to match log_id\r
+ALTER TABLE /*$wgDBprefix*/recentchanges \r
+  ADD rc_deleted tinyint(1) unsigned NOT NULL default '0',\r
+  ADD rc_logid int(10) unsigned NOT NULL default '0',\r
+  ADD rc_log_type varchar(255) binary NULL default NULL,\r
+  ADD rc_log_action varchar(255) binary NULL default NULL,\r
+  ADD rc_params blob NOT NULL default '',
\ No newline at end of file
index e75e903..b04d90d 100644 (file)
@@ -392,6 +392,9 @@ CREATE TABLE /*$wgDBprefix*/archive (
   -- row upon undeletion.
   ar_text_id int(8) unsigned,
   
+  -- rev_deleted for archives
+  ar_deleted tinyint(1) unsigned NOT NULL default '0',
+  
   KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp)
 
 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
@@ -634,6 +637,8 @@ CREATE TABLE /*$wgDBprefix*/ipblocks (
   -- Size chosen to allow IPv6
   ipb_range_start tinyblob NOT NULL,
   ipb_range_end tinyblob NOT NULL,
+  -- Flag for entries hidden from users and Sysops
+  ipb_deleted bool NOT NULL default 0,
 
   PRIMARY KEY ipb_id (ipb_id),
 
@@ -776,6 +781,9 @@ CREATE TABLE /*$wgDBprefix*/filearchive (
   fa_user_text varchar(255) binary,
   fa_timestamp char(14) binary default '',
   
+  -- Visibility of deleted revisions, bitfield
+  fa_deleted tinyint(1) unsigned NOT NULL default '0',
+  
   PRIMARY KEY (fa_id),
   INDEX (fa_name, fa_timestamp),             -- pick out by image name
   INDEX (fa_storage_group, fa_storage_key),  -- pick out dupe files
@@ -844,6 +852,18 @@ CREATE TABLE /*$wgDBprefix*/recentchanges (
   rc_old_len int(10),
   rc_new_len int(10),
 
+  -- Visibility of deleted revisions, bitfield
+  rc_deleted tinyint(1) unsigned NOT NULL default '0',
+  
+  -- Value corresonding to log_id, specific log entries
+  rc_logid int(10) unsigned NOT NULL default '0',
+  -- Store log type info here, or null
+  rc_log_type varchar(255) binary NULL default NULL,
+  -- Store log action or null
+  rc_log_action varchar(255) binary NULL default NULL,
+  -- Log params
+  rc_params blob NOT NULL default '',
+  
   PRIMARY KEY rc_id (rc_id),
   INDEX rc_timestamp (rc_timestamp),
   INDEX rc_namespace_title (rc_namespace, rc_title),
@@ -1010,6 +1030,9 @@ CREATE TABLE /*$wgDBprefix*/logging (
   
   -- LF separated list of miscellaneous parameters
   log_params blob NOT NULL,
+  
+  -- rev_deleted for logs
+  log_deleted tinyint(1) unsigned NOT NULL default '0',
 
   KEY type_time (log_type, log_timestamp),
   KEY user_time (log_user, log_timestamp),
index 8a8fed1..ac9e8e5 100644 (file)
@@ -383,6 +383,9 @@ CREATE TABLE /*$wgDBprefix*/archive (
   -- row upon undeletion.
   ar_text_id int(8) unsigned,
   
+  -- rev_deleted for archives
+  ar_deleted tinyint(1) unsigned NOT NULL default '0',
+  
   KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp)
 
 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
@@ -625,6 +628,8 @@ CREATE TABLE /*$wgDBprefix*/ipblocks (
   -- Size chosen to allow IPv6
   ipb_range_start tinyblob NOT NULL,
   ipb_range_end tinyblob NOT NULL,
+  -- Flag for entries hidden from users and Sysops
+  ipb_deleted bool NOT NULL default 0,
   
   PRIMARY KEY ipb_id (ipb_id),
 
@@ -753,6 +758,9 @@ CREATE TABLE /*$wgDBprefix*/filearchive (
   fa_deleted_timestamp char(14) binary default '',
   fa_deleted_reason text,
   
+  -- Visibility of deleted revisions, bitfield
+  fa_deleted tinyint(1) unsigned NOT NULL default '0',
+  
   -- Duped fields from image
   fa_size int(8) unsigned default '0',
   fa_width int(5) default '0',
@@ -829,12 +837,24 @@ CREATE TABLE /*$wgDBprefix*/recentchanges (
   -- Recorded IP address the edit was made from, if the
   -- $wgPutIPinRC option is enabled.
   rc_ip char(15) NOT NULL default '',
-  
+
   -- Text length in characters before
   -- and after the edit
   rc_old_len int(10),
   rc_new_len int(10),
 
+  -- Visibility of deleted revisions, bitfield
+  rc_deleted tinyint(1) unsigned NOT NULL default '0',
+  
+  -- Value corresonding to log_id, specific log entries
+  rc_logid int(10) unsigned NOT NULL default '0',
+  -- Store log type info here, or null
+  rc_log_type varchar(255) binary NULL default NULL,
+  -- Store log action or null
+  rc_log_action varchar(255) binary NULL default NULL,
+  -- Log params
+  rc_params blob NOT NULL default '',
+  
   PRIMARY KEY rc_id (rc_id),
   INDEX rc_timestamp (rc_timestamp),
   INDEX rc_namespace_title (rc_namespace, rc_title),
@@ -1006,6 +1026,9 @@ CREATE TABLE /*$wgDBprefix*/logging (
   KEY user_time (log_user, log_timestamp),
   KEY page_time (log_namespace, log_title, log_timestamp),
   KEY times (log_timestamp)
+  
+  -- rev_deleted for logs
+  log_deleted tinyint(1) unsigned NOT NULL default '0',
 
 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
 
index b8412ba..fb53d87 100644 (file)
@@ -113,7 +113,7 @@ CREATE TABLE pagecontent ( -- replaces reserved word 'text'
 
 CREATE SEQUENCE pr_id_val;
 CREATE TABLE page_restrictions (
-  pr_id      INTEGER      NOT NULL  PRIMARY KEY DEFAULT nextval('pr_id_val'),
+  pr_id      INTEGER      NOT NULL  UNIQUE DEFAULT nextval('pr_id_val'),
   pr_page    INTEGER          NULL  REFERENCES page (page_id) ON DELETE CASCADE,
   pr_type    TEXT         NOT NULL,
   pr_level   TEXT         NOT NULL,
@@ -135,7 +135,8 @@ CREATE TABLE archive2 (
   ar_minor_edit  CHAR         NOT NULL  DEFAULT '0',
   ar_flags       TEXT,
   ar_rev_id      INTEGER,
-  ar_text_id     INTEGER
+  ar_text_id     INTEGER,
+  ar_deleted     INTEGER        NOT NULL DEFAULT '0',
 );
 CREATE INDEX archive_name_title_timestamp ON archive2 (ar_namespace,ar_title,ar_timestamp);
 
@@ -246,6 +247,7 @@ CREATE TABLE ipblocks (
   ipb_expiry            TIMESTAMPTZ  NOT NULL,
   ipb_range_start       TEXT,
   ipb_range_end         TEXT
+  ipb_deleted           INTEGER      NOT NULL, DEFAULT '0',
 );
 CREATE INDEX ipb_address ON ipblocks (ipb_address);
 CREATE INDEX ipb_user    ON ipblocks (ipb_user);
@@ -306,6 +308,7 @@ CREATE TABLE filearchive (
   fa_user               INTEGER          NULL  REFERENCES mwuser(user_id) ON DELETE SET NULL,
   fa_user_text          TEXT         NOT NULL,
   fa_timestamp          TIMESTAMPTZ
+  fa_deleted            INTEGER      NOT NULL DEFAULT '0',
 );
 CREATE INDEX fa_name_time ON filearchive (fa_name, fa_timestamp);
 CREATE INDEX fa_dupe      ON filearchive (fa_storage_group, fa_storage_key);
@@ -335,7 +338,12 @@ CREATE TABLE recentchanges (
   rc_patrolled       CHAR         NOT NULL  DEFAULT '0',
   rc_ip              CIDR,
   rc_old_len         INTEGER,
-  rc_new_len         INTEGER
+  rc_new_len         INTEGER,
+  rc_deleted         INTEGER      NOT NULL  DEFAULT '0',
+  rc_logid           INTEGER      NOT NULL  DEFAULT '0',
+  rc_log_type           TEXT,
+  rc_log_action      TEXT,
+  rc_params             TEXT,
 );
 CREATE INDEX rc_timestamp       ON recentchanges (rc_timestamp);
 CREATE INDEX rc_namespace_title ON recentchanges (rc_namespace, rc_title);
@@ -410,6 +418,7 @@ CREATE TABLE transcache (
 );
 
 
+CREATE SEQUENCE log_log_id_seq;
 CREATE TABLE logging (
   log_type        TEXT         NOT NULL,
   log_action      TEXT         NOT NULL,
@@ -418,7 +427,9 @@ CREATE TABLE logging (
   log_namespace   SMALLINT     NOT NULL,
   log_title       TEXT         NOT NULL,
   log_comment     TEXT,
-  log_params      TEXT
+  log_params      TEXT,
+  log_deleted     INTEGER      NOT NULL DEFAULT '0',
+  log_id          INTEGER      NOT NULL PRIMARY KEY DEFAULT nextval('log_log_id_seq'),
 );
 CREATE INDEX logging_type_name ON logging (log_type, log_timestamp);
 CREATE INDEX logging_user_time ON logging (log_timestamp, log_user);
index ca2da34..c65e4f3 100644 (file)
@@ -63,10 +63,15 @@ $wgNewFields = array(
        array( 'ipblocks',      'ipb_range_start',  'patch-ipb_range_start.sql' ),
        array( 'site_stats',    'ss_images',        'patch-ss_images.sql' ),
        array( 'ipblocks',      'ipb_anon_only',    'patch-ipb_anon_only.sql' ),
-       array( 'ipblocks',      'ipb_enable_autoblock', 'patch-ipb_optional_autoblock.sql' ),
+       array( 'ipblocks',              'ipb_enable_autoblock', 'patch-ipb_optional_autoblock.sql' ),
        array( 'user',          'user_newpass_time','patch-user_newpass_time.sql' ),
        array( 'user',          'user_editcount',   'patch-user_editcount.sql' ),
-       array( 'logging',       'log_id',               'patch-log_id.sql' ),
+       array( 'recentchanges', 'rc_deleted',           'patch-rc_deleted.sql' ),
+       array( 'logging',               'log_id',                       'patch-log_id.sql' ),
+       array( 'logging',               'log_deleted',          'patch-log_deleted.sql' ),
+       array( 'archive',               'ar_deleted',           'patch-ar_deleted.sql' ),
+       array( 'ipblocks',              'ipb_deleted',          'patch-ipb_deleted.sql' ),
+       array( 'filearchive',   'fa_deleted',           'patch-fa_deleted.sql' ),
        array( 'page_restrictions', 'pr_id',            'patch-page_restrictions_sortkey.sql' ),
        array( 'revision',      'rev_len',              'patch-rev_len.sql' ),
        array( 'revision',      'rev_parent_id',        'patch-rev_parent_id.sql' ),