Fixups for page id field in the archive table:
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 11 Aug 2007 14:43:47 +0000 (14:43 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 11 Aug 2007 14:43:47 +0000 (14:43 +0000)
* Make the field nullable for consistency with ar_rev_id and ar_text_id and between MySQL and PostgreSQL and generally so you can cleanly tell between bogus fields and ones that predate use of the field
* Remove duplicate incorrect adding of the field for postgres
* Rename to ar_page_id for consistency with ar_rev_id and ar_text_id
* Rename the patch file for naming consistency

Note that there's no documentation of this schema change in the release notes either, which bugs me a bit.

includes/Article.php
maintenance/archives/patch-archive-ar_page.sql [deleted file]
maintenance/archives/patch-archive-page_id.sql [new file with mode: 0644]
maintenance/postgres/tables.sql
maintenance/tables.sql
maintenance/updaters.inc

index 086e68c..56feb72 100644 (file)
@@ -2114,7 +2114,7 @@ class Article {
                                'ar_text'       => '\'\'', // Be explicit to appease
                                'ar_flags'      => '\'\'', // MySQL's "strict mode"...
                                'ar_len'                => 'rev_len',
-                               'ar_page'       => $id
+                               'ar_page_id'    => 'page_id',
                        ), array(
                                'page_id' => $id,
                                'page_id = rev_page'
diff --git a/maintenance/archives/patch-archive-ar_page.sql b/maintenance/archives/patch-archive-ar_page.sql
deleted file mode 100644 (file)
index 4ea98cf..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
--- Reference to page_id. Useful for sysadmin fixing of large\r
--- pages merged together in the archives\r
--- Added 2007-07-21\r
-\r
-ALTER TABLE /*$wgDBprefix*/archive\r
-  ADD ar_page int unsigned NOT NULL;\r
diff --git a/maintenance/archives/patch-archive-page_id.sql b/maintenance/archives/patch-archive-page_id.sql
new file mode 100644 (file)
index 0000000..47a1c47
--- /dev/null
@@ -0,0 +1,6 @@
+-- Reference to page_id. Useful for sysadmin fixing of large
+-- pages merged together in the archives
+-- Added 2007-07-21
+
+ALTER TABLE /*$wgDBprefix*/archive
+  ADD ar_page_id int unsigned;
index 30ea077..6f91efa 100644 (file)
@@ -128,7 +128,7 @@ CREATE TABLE archive (
   ar_namespace   SMALLINT     NOT NULL,
   ar_title       TEXT         NOT NULL,
   ar_text        TEXT,
-  ar_page        INTEGER          NULL,
+  ar_page_id     INTEGER          NULL,
   ar_comment     TEXT,
   ar_user        INTEGER          NULL  REFERENCES mwuser(user_id) ON DELETE SET NULL,
   ar_user_text   TEXT         NOT NULL,
index d76e5a8..08119cd 100644 (file)
@@ -378,8 +378,11 @@ CREATE TABLE /*$wgDBprefix*/archive (
   ar_len int unsigned,
 
   -- Reference to page_id. Useful for sysadmin fixing of large pages 
-  -- merged together in the archives
-  ar_page int unsigned NOT NULL,
+  -- merged together in the archives, or for cleanly restoring a page
+  -- at its original ID number if possible.
+  --
+  -- Will be NULL for pages deleted prior to 1.11.
+  ar_page_id int unsigned,
   
   KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp),
   KEY usertext_timestamp (ar_user_text,ar_timestamp)
index 407da30..e8fd206 100644 (file)
@@ -81,7 +81,7 @@ $wgNewFields = array(
        array( 'page_restrictions', 'pr_id',            'patch-page_restrictions_sortkey.sql' ),
        array( 'ipblocks',      'ipb_block_email',  'patch-ipb_emailban.sql' ),
        array( 'oldimage',      'oi_metadata',      'patch-oi_metadata.sql'),
-       array( 'archive',       'ar_page',          'patch-archive-ar_page.sql'),
+       array( 'archive',       'ar_page_id',       'patch-archive-page_id.sql'),
        array( 'image',         'img_sha1',         'patch-img_sha1.sql' ),
 );
 
@@ -1319,7 +1319,7 @@ function do_postgres_updates() {
 
        $newcols = array(
                array("archive",       "ar_len",               "INTEGER"),
-               array("archive",       "ar_page",              "INTEGER"),
+               array("archive",       "ar_page_id",           "INTEGER"),
                array("image",         "img_sha1",             "TEXT NOT NULL DEFAULT ''"),
                array("ipblocks",      "ipb_anon_only",        "CHAR NOT NULL DEFAULT '0'"),
                array("ipblocks",      "ipb_block_email",      "CHAR NOT NULL DEFAULT '0'"),
@@ -1347,7 +1347,6 @@ function do_postgres_updates() {
                array("recentchanges", "rc_old_len",           "INTEGER"),
                array("recentchanges", "rc_params",            "TEXT"),
                array("revision",      "rev_len",              "INTEGER"),
-               array("archive",       "ar_page",              "INTEGER NOT NULL DEFAULT 0"),
        );