User:RichMorin/mw archive

From Meta, a Wikimedia project coordination wiki

Holding area for deleted articles, which may be viewed or restored by admins through the Special:Undelete interface. The fields generally correspond to the page, revision, and text fields, with several caveats.


Inter-table Relationships[edit]

  • ar_namespace - page namespace ( page.page_namespace)
  • ar_text_id - text ID ( text.old_id)
  • ar_title - page title ( page.page_title)
  • ar_user - user ID ( user.user_id)
  • ar_user_text - user name ( user.user_name)


MySQL Table Description[edit]

mysql> desc mw_archive;
+---------------+-----------------+------+-----+---------+-------+
| Field         | Type            | Null | Key | Default | Extra |
+---------------+-----------------+------+-----+---------+-------+
| ar_namespace  | int(11)         |      | MUL | 0       |       |
| ar_title      | varchar(255)    |      |     |         |       |
| ar_text       | mediumblob      |      |     |         |       |
| ar_comment    | tinyblob        |      |     |         |       |
| ar_user       | int(5) unsigned |      |     | 0       |       |
| ar_user_text  | varchar(255)    |      |     |         |       |
| ar_timestamp  | varchar(14)     |      |     |         |       |
| ar_minor_edit | tinyint(1)      |      |     | 0       |       |
| ar_flags      | tinyblob        |      |     |         |       |
| ar_rev_id     | int(8) unsigned | YES  |     | NULL    |       |
| ar_text_id    | int(8) unsigned | YES  |     | NULL    |       |
+---------------+-----------------+------+-----+---------+-------+
11 rows in set

Annotated Table Creation Code[edit]

-- Holding area for deleted articles, which may be viewed
-- or restored by admins through the Special:Undelete interface.
-- The fields generally correspond to the page, revision, and text
-- fields, with several caveats.

CREATE TABLE /*$wgDBprefix*/archive (

  -- namespace and title for the article

  ar_namespace        int                         NOT NULL  default '0',
  ar_title            varchar(255)   binary       NOT NULL  default '',

  -- article text (copy of old_text, from the V1.4 "old" table)
  --  
  -- Newly deleted pages will not store text in this table,
  -- but will reference the separately existing text rows.
  -- This field is retained for backwards compatibility,
  -- so old archived pages will remain accessible after
  -- upgrading from 1.4 to 1.5.
  -- Text may be gzipped or otherwise funky.

  ar_text             mediumblob                  NOT NULL  default '',
  
  -- Basic revision stuff...

  -- comments on the article

  ar_comment          tinyblob                    NOT NULL  default '',

  -- ID and name of the user that revised the article

  ar_user             int(5)         unsigned     NOT NULL  default '0',
  ar_user_text        varchar(255)   binary       NOT NULL,

  -- timestamp of the revision

  ar_timestamp        char(14)       binary       NOT NULL  default '',

  -- "minor edit" flag

  ar_minor_edit       tinyint(1)                  NOT NULL  default '0',
  
   -- copy of old_flags, from the V1.4 "old" table

  ar_flags            tinyblob                    NOT NULL  default '',
  
  -- When revisions are deleted, their unique rev_id is stored here,
  -- so it can be retained after undeletion. This is necessary
  -- to retain permalinks to given revisions after accidental delete
  -- cycles or messy operations like history merges.
  -- 
  -- Old entries from 1.4 will be NULL here, and a new rev_id will
  -- be created on undeletion for those revisions.

  ar_rev_id           int(8)         unsigned,
  
  -- For newly deleted revisions, this is the text.old_id key to the
  -- actual stored text. To avoid breaking the block-compression scheme
  -- and otherwise making storage changes harder, the actual text is
  -- *not* deleted from the text table, merely hidden by removal of the
  -- page and revision entries.
  --
  -- Old entries deleted under 1.2-1.4 will have NULL here, and their
  -- ar_text and ar_flags fields will be used to create a new text
  -- row upon undeletion.

  ar_text_id          int(8)         unsigned,
  
  KEY name_title_timestamp (ar_namespace, ar_title, ar_timestamp)

) ENGINE=InnoDB;