User:RichMorin/mw recentchanges

Primarily a summary table for Special:Recentchanges, this table contains some additional info on edits from the last few days. See Article::editUpdates()


Inter-table Relationships

edit
  • rc_comment - comment text ( revision.rev_comment)
  • rc_cur_id - page ID ( page.page_id)
  • rc_last_oldid - revision ID ( revision.rev_id)
  • rc_minor - "minor edit" flag ( revision.rev_minor_edit)
  • rc_namespace - page namespace ( page.page_namespace)
  • rc_this_oldid - revision ID ( revision.rev_id)
  • rc_title - page title ( page.page_title)
  • rc_user - user ID ( user.user_id)
  • rc_user_text - user name ( user.user_name)


MySQL Table Description

edit
mysql> desc mw_recentchanges;
+-------------------+---------------------+------+-----+---------+----------------+
| Field             | Type                | Null | Key | Default | Extra          |
+-------------------+---------------------+------+-----+---------+----------------+
| rc_id             | int(8)              |      | PRI | NULL    | auto_increment |
| rc_timestamp      | varchar(14)         |      | MUL |         |                |
| rc_cur_time       | varchar(14)         |      |     |         |                |
| rc_user           | int(10) unsigned    |      |     | 0       |                |
| rc_user_text      | varchar(255)        |      |     |         |                |
| rc_namespace      | int(11)             |      | MUL | 0       |                |
| rc_title          | varchar(255)        |      |     |         |                |
| rc_comment        | varchar(255)        |      |     |         |                |
| rc_minor          | tinyint(3) unsigned |      |     | 0       |                |
| rc_bot            | tinyint(3) unsigned |      |     | 0       |                |
| rc_new            | tinyint(3) unsigned |      | MUL | 0       |                |
| rc_cur_id         | int(10) unsigned    |      | MUL | 0       |                |
| rc_this_oldid     | int(10) unsigned    |      |     | 0       |                |
| rc_last_oldid     | int(10) unsigned    |      |     | 0       |                |
| rc_type           | tinyint(3) unsigned |      |     | 0       |                |
| rc_moved_to_ns    | tinyint(3) unsigned |      |     | 0       |                |
| rc_moved_to_title | varchar(255)        |      |     |         |                |
| rc_patrolled      | tinyint(3) unsigned |      |     | 0       |                |
| rc_ip             | varchar(15)         |      | MUL |         |                |
+-------------------+---------------------+------+-----+---------+----------------+
19 rows in set


Annotated Table Creation Code

edit
-- Primarily a summary table for Special:Recentchanges,
-- this table contains some additional info on edits
-- from the last few days.
-- See <tt>Article::editUpdates()</tt>


CREATE TABLE /*$wgDBprefix*/recentchanges (

  rc_id               int(8)                      NOT NULL  auto_increment,
  rc_timestamp        varchar(14)    binary       NOT NULL  default '',
  rc_cur_time         varchar(14)    binary       NOT NULL  default '',
  
  -- As in revision

  rc_user             int(10)        unsigned     NOT NULL  default '0',
  rc_user_text        varchar(255)   binary       NOT NULL  default '',
  
  -- When pages are renamed, their RC entries do _not_ change.

  rc_namespace        int                         NOT NULL  default '0',
  rc_title            varchar(255)   binary       NOT NULL  default '',
  
  -- As in revision...

  rc_comment          varchar(255)   binary       NOT NULL  default '',
  rc_minor            tinyint(3)     unsigned     NOT NULL  default '0',
  
  -- Edits by user accounts with the 'bot' rights key
  -- are marked with a 1 here, and will be hidden
  -- from the default view.

  rc_bot              tinyint(3)     unsigned     NOT NULL  default '0',
  
  rc_new              tinyint(3)     unsigned     NOT NULL  default '0',
  
  -- Key to page_id (was cur_id, prior to 1.5).
  -- This will keep links working after moves,
  -- while retaining the at-the-time name
  -- in the changes list.

  rc_cur_id           int(10)        unsigned     NOT NULL  default '0',
  
  -- rev_id of the given revision

  rc_this_oldid       int(10)        unsigned     NOT NULL  default '0',
  
  -- rev_id of the prior revision, for generating diff links.

  rc_last_oldid       int(10)        unsigned     NOT NULL  default '0',
  
  -- These may no longer be used, with the new move log.

  rc_type             tinyint(3)     unsigned     NOT NULL  default '0',
  rc_moved_to_ns      tinyint(3)     unsigned     NOT NULL  default '0',
  rc_moved_to_title   varchar(255)   binary       NOT NULL  default '',
  
  -- If the Recent Changes Patrol option is enabled,
  -- users may mark edits as having been reviewed to
  -- remove a warning flag on the RC list.
  -- A value of 1 indicates that the page has been reviewed.

  rc_patrolled        tinyint(3)     unsigned     NOT NULL  default '0',
  
  -- Recorded IP address the edit was made from,
  -- if the $wgPutIPinRC option is enabled.

  rc_ip               char(15)                    NOT NULL  default '',
  
PRIMARY KEY           rc_id (rc_id),
INDEX                 rc_timestamp (rc_timestamp),
INDEX                 rc_namespace_title (rc_namespace, rc_title),
INDEX                 rc_cur_id (rc_cur_id),
INDEX                 new_name_timestamp (rc_new, rc_namespace, rc_timestamp),
INDEX                 rc_ip (rc_ip)

) ENGINE=InnoDB;