User:RichMorin/mw ipblocks

The Internet is full of jerks, alas. Sometimes it's handy to block a vandal or troll account.


Inter-table Relationships

edit
  • ipb_by - user ID ( user.user_id)
  • ipb_user - user ID ( user.user_id)


MySQL Table Description

edit
mysql> desc mw_ipblocks;
+-----------------+-----------------+------+-----+---------+----------------+
| Field           | Type            | Null | Key | Default | Extra          |
+-----------------+-----------------+------+-----+---------+----------------+
| ipb_id          | int(8)          |      | PRI | NULL    | auto_increment |
| ipb_address     | varchar(40)     |      | MUL |         |                |
| ipb_user        | int(8) unsigned |      | MUL | 0       |                |
| ipb_by          | int(8) unsigned |      |     | 0       |                |
| ipb_reason      | tinyblob        |      |     |         |                |
| ipb_timestamp   | varchar(14)     |      |     |         |                |
| ipb_auto        | tinyint(1)      |      |     | 0       |                |
| ipb_expiry      | varchar(14)     |      |     |         |                |
| ipb_range_start | varchar(32)     |      |     |         |                |
| ipb_range_end   | varchar(32)     |      |     |         |                |
+-----------------+-----------------+------+-----+---------+----------------+
10 rows in set

  ipb_range_start     varchar(32)                 NOT NULL  default '',
  ipb_range_end       varchar(32)                 NOT NULL  default '',

-- The Internet is full of jerks, alas. Sometimes it's handy
-- to block a vandal or troll account.

CREATE TABLE /*$wgDBprefix*/ipblocks (

  -- Primary key, introduced for privacy.

  ipb_id              int(8)                      NOT NULL  auto_increment,
  
  -- Blocked IP address in dotted-quad form or user name.

  ipb_address     varchar(40)    binary       NOT NULL  default '',
  
  -- Blocked user ID or 0 for IP blocks.

  ipb_user            int(8)         unsigned     NOT NULL  default '0',
  
  -- User ID who made the block.

  ipb_by              int(8)         unsigned     NOT NULL  default '0',
  
  -- Text comment made by blocker.

  ipb_reason          tinyblob                    NOT NULL  default '',
  
  -- Creation (or refresh) date in standard YMDHMS form.
  -- IP blocks expire automatically.

  ipb_timestamp       char(14)       binary       NOT NULL  default '',
  
  -- Indicates that the IP address was banned because a banned
  -- user accessed a page through it. If this is 1, ipb_address
  -- will be hidden, and the block identified by block ID number.

  ipb_auto            tinyint(1)                  NOT NULL  default '0',
  
  -- Time at which the block will expire.

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

  -- Start and end of an address range, in hexadecimal
  -- Size chosen to allow IPv6

  ipb_range_start     varchar(32)                 NOT NULL  default '',
  ipb_range_end       varchar(32)                 NOT NULL  default '',

  PRIMARY KEY         ipb_id (ipb_id),
  INDEX               ipb_address (ipb_address),
  INDEX               ipb_user (ipb_user),
  INDEX               ipb_range (ipb_range_start(8), ipb_range_end(8))

) ENGINE=InnoDB;