User:RichMorin/mw oldimage

From Meta, a Wikimedia project coordination wiki

Previous revisions of uploaded files. Awkwardly, image rows have to be moved into this table at re-upload time.


Inter-table Relationships[edit]

  • oi_name - image name ( image.img_name)
  • oi_user - user ID ( user.user_id)
  • oi_user_text - user name ( user.user_name)


MySQL Table Description[edit]

mysql> desc mw_oldimage;
+-----------------+-----------------+------+-----+---------+-------+
| Field           | Type            | Null | Key | Default | Extra |
+-----------------+-----------------+------+-----+---------+-------+
| oi_name         | varchar(255)    |      | MUL |         |       |
| oi_archive_name | varchar(255)    |      |     |         |       |
| oi_size         | int(8) unsigned |      |     | 0       |       |
| oi_width        | int(5)          |      |     | 0       |       |
| oi_height       | int(5)          |      |     | 0       |       |
| oi_bits         | int(3)          |      |     | 0       |       |
| oi_description  | tinyblob        |      |     |         |       |
| oi_user         | int(5) unsigned |      |     | 0       |       |
| oi_user_text    | varchar(255)    |      |     |         |       |
| oi_timestamp    | varchar(14)     |      |     |         |       |
+-----------------+-----------------+------+-----+---------+-------+
10 rows in set


Annotated Table Creation Code[edit]

-- Previous revisions of uploaded files.
-- Awkwardly, image rows have to be moved into
-- this table at re-upload time.

CREATE TABLE /*$wgDBprefix*/oldimage (

  -- Base filename: key to image.img_name

  oi_name             varchar(255)   binary       NOT NULL  default '',
  
  -- Filename of the archived file.
  -- This is generally a timestamp and '!',
  -- prepended to the base name.

  oi_archive_name     varchar(255)   binary       NOT NULL  default '',
  
  -- Other fields, as in image...

  oi_size             int(8)         unsigned     NOT NULL  default 0,
  oi_width            int(5)                      NOT NULL  default 0,
  oi_height           int(5)                      NOT NULL  default 0,
  oi_bits             int(3)                      NOT NULL  default 0,
  oi_description      tinyblob                    NOT NULL  default '',
  oi_user             int(5)         unsigned     NOT NULL  default '0',
  oi_user_text        varchar(255)   binary       NOT NULL  default '',
  oi_timestamp        char(14)       binary       NOT NULL  default '',

INDEX                 oi_name (oi_name(10))

) ENGINE=InnoDB;