-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: sql/discussiontools_persistent.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/discussiontools_items (
  it_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  it_itemname VARBINARY(255) NOT NULL,
  it_timestamp BINARY(14) DEFAULT NULL,
  it_actor BIGINT UNSIGNED DEFAULT NULL,
  UNIQUE INDEX it_itemname (it_itemname),
  PRIMARY KEY(it_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/discussiontools_item_ids (
  itid_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  itid_itemid VARBINARY(255) NOT NULL,
  UNIQUE INDEX itid_itemid (itid_itemid),
  PRIMARY KEY(itid_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/discussiontools_item_pages (
  itp_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  itp_items_id INT UNSIGNED NOT NULL,
  itp_page_id BIGINT UNSIGNED NOT NULL,
  itp_oldest_revision_id BIGINT UNSIGNED NOT NULL,
  itp_newest_revision_id BIGINT UNSIGNED NOT NULL,
  UNIQUE INDEX itp_items_id_page_id (itp_items_id, itp_page_id),
  UNIQUE INDEX itp_items_id_newest_revision_id (
    itp_items_id, itp_newest_revision_id
  ),
  PRIMARY KEY(itp_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/discussiontools_item_revisions (
  itr_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  itr_itemid_id INT NOT NULL,
  itr_revision_id BIGINT UNSIGNED NOT NULL,
  itr_items_id INT NOT NULL,
  itr_parent_id INT DEFAULT NULL,
  itr_transcludedfrom BIGINT UNSIGNED DEFAULT NULL,
  itr_level TINYINT NOT NULL,
  itr_headinglevel TINYINT DEFAULT NULL,
  INDEX itr_revision_id (itr_revision_id),
  UNIQUE INDEX itr_itemid_id_revision_id (itr_itemid_id, itr_revision_id),
  PRIMARY KEY(itr_id)
) /*$wgDBTableOptions*/;
