User:RichMorin/mw pagelinks

From Meta, a Wikimedia project coordination wiki

Track page-to-page hyperlinks within the wiki.


Inter-table Relationships[edit]

  • pl_from - page ID ( page.page_id)
  • pl_namespace - page namespace ( page.page_namespace)
  • pl_title - page title ( page.page_title)


MySQL Table Description[edit]

mysql> desc mw_pagelinks;
+--------------+-----------------+------+-----+---------+-------+
| Field        | Type            | Null | Key | Default | Extra |
+--------------+-----------------+------+-----+---------+-------+
| pl_from      | int(8) unsigned |      | PRI | 0       |       |
| pl_namespace | int(11)         |      | PRI | 0       |       |
| pl_title     | varchar(255)    |      | PRI |         |       |
+--------------+-----------------+------+-----+---------+-------+
3 rows in set


Annotated Table Creation Code[edit]

-- Track page-to-page hyperlinks within the wiki.

CREATE TABLE /*$wgDBprefix*/pagelinks (

  -- Key to the page_id of the page containing the link.

  pl_from             int(8)         unsigned     NOT NULL  default '0',
  
  -- Key to page_namespace/page_title of the target page.
  -- The target page may or may not exist, and due to renames
  -- and deletions, may refer to different page records
  -- as time goes by.

  pl_namespace        int                         NOT NULL  default '0',
  pl_title            varchar(255)   binary       NOT NULL  default '',
  
UNIQUE KEY            pl_from(pl_from, pl_namespace, pl_title),
KEY                   (pl_namespace, pl_title)

) ENGINE=InnoDB;