-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: sql/tables.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/cn_notices (
  not_id INT AUTO_INCREMENT NOT NULL,
  not_name VARCHAR(255) NOT NULL,
  not_start BINARY(14) NOT NULL,
  not_end BINARY(14) NOT NULL,
  not_enabled TINYINT(1) DEFAULT 0 NOT NULL,
  not_preferred TINYINT(1) DEFAULT 0 NOT NULL,
  not_throttle INT DEFAULT 100 NOT NULL,
  not_locked TINYINT(1) DEFAULT 0 NOT NULL,
  not_geo TINYINT(1) DEFAULT 0 NOT NULL,
  not_buckets TINYINT(1) DEFAULT 1 NOT NULL,
  not_weight INT DEFAULT 100 NOT NULL,
  not_mobile_carrier TINYINT(1) DEFAULT 0 NOT NULL,
  not_archived TINYINT(1) DEFAULT 0 NOT NULL,
  not_type VARCHAR(255) DEFAULT NULL,
  PRIMARY KEY(not_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_assignments (
  asn_id INT AUTO_INCREMENT NOT NULL,
  not_id INT NOT NULL,
  tmp_id INT NOT NULL,
  tmp_weight INT NOT NULL,
  asn_bucket TINYINT(1) DEFAULT 0,
  INDEX asn_not (not_id),
  INDEX asn_tmp (tmp_id),
  INDEX asn_bucket (asn_bucket),
  PRIMARY KEY(asn_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_templates (
  tmp_id INT AUTO_INCREMENT NOT NULL,
  tmp_name VARCHAR(255) DEFAULT NULL,
  tmp_display_anon TINYINT(1) DEFAULT 1 NOT NULL,
  tmp_display_account TINYINT(1) DEFAULT 1 NOT NULL,
  tmp_fundraising TINYINT(1) DEFAULT 0 NOT NULL,
  tmp_autolink TINYINT(1) DEFAULT 0 NOT NULL,
  tmp_landing_pages VARCHAR(255) DEFAULT NULL,
  tmp_archived TINYINT(1) DEFAULT 0 NOT NULL,
  tmp_category VARCHAR(255) DEFAULT NULL,
  tmp_preview_sandbox TINYINT(1) DEFAULT 0 NOT NULL,
  tmp_is_template TINYINT(1) DEFAULT 0 NOT NULL,
  INDEX tmp_name (tmp_name),
  INDEX tmp_category (tmp_category),
  PRIMARY KEY(tmp_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_notice_languages (
  nl_notice_id INT UNSIGNED NOT NULL,
  nl_language VARCHAR(32) NOT NULL,
  UNIQUE INDEX nl_notice_id_language (nl_notice_id, nl_language)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_notice_projects (
  np_notice_id INT UNSIGNED NOT NULL,
  np_project VARCHAR(32) NOT NULL,
  UNIQUE INDEX np_notice_id_project (np_notice_id, np_project)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_notice_countries (
  nc_notice_id INT UNSIGNED NOT NULL,
  nc_country VARCHAR(2) NOT NULL,
  UNIQUE INDEX nc_notice_id_country (nc_notice_id, nc_country)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_notice_regions (
  nr_notice_id INT UNSIGNED NOT NULL,
  nr_region VARCHAR(6) NOT NULL,
  UNIQUE INDEX nr_notice_id_region (nr_notice_id, nr_region)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_template_mixins (
  tmxn_id INT AUTO_INCREMENT NOT NULL,
  tmp_id INT NOT NULL,
  page_id INT NOT NULL,
  mixin_name VARCHAR(255) NOT NULL,
  INDEX tmxn_tmp_id (tmp_id),
  INDEX tmxn_page_id (page_id),
  INDEX tmxn_mixin_name (mixin_name),
  PRIMARY KEY(tmxn_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_notice_mixins (
  nmxn_id INT AUTO_INCREMENT NOT NULL,
  nmxn_not_id INT NOT NULL,
  nmxn_mixin_name VARCHAR(255) NOT NULL,
  nmxn_enabled TINYINT(1) DEFAULT 0 NOT NULL,
  INDEX nmxn_not_id_idx (nmxn_not_id),
  INDEX nmxn_mixin_name_idx (nmxn_mixin_name),
  UNIQUE INDEX nmxn_not_id_mixin_name (nmxn_not_id, nmxn_mixin_name),
  PRIMARY KEY(nmxn_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_notice_mixin_params (
  nmxnp_id INT AUTO_INCREMENT NOT NULL,
  nmxnp_notice_mixin_id INT NOT NULL,
  nmxnp_param_name VARCHAR(255) NOT NULL,
  nmxnp_param_value TEXT NOT NULL,
  INDEX nmxnp_notice_mixin_id_idx (nmxnp_notice_mixin_id),
  INDEX nmxnp_param_name_value_idx (
    nmxnp_param_name,
    nmxnp_param_value(50)
  ),
  UNIQUE INDEX nmxn_notice_mixin_id_param_name (
    nmxnp_notice_mixin_id, nmxnp_param_name
  ),
  PRIMARY KEY(nmxnp_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_known_devices (
  dev_id INT AUTO_INCREMENT NOT NULL,
  dev_name VARCHAR(255) NOT NULL,
  dev_display_label VARBINARY(255) NOT NULL,
  INDEX dev_name (dev_name),
  PRIMARY KEY(dev_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_template_devices (
  tdev_id INT AUTO_INCREMENT NOT NULL,
  tmp_id INT NOT NULL,
  dev_id INT NOT NULL,
  INDEX tdev_template_id (tmp_id),
  PRIMARY KEY(tdev_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_known_mobile_carriers (
  mc_id INT AUTO_INCREMENT NOT NULL,
  mc_name VARCHAR(255) NOT NULL,
  mc_display_label VARBINARY(255) NOT NULL,
  INDEX mc_name (mc_name),
  PRIMARY KEY(mc_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_notice_mobile_carriers (
  nmc_id INT AUTO_INCREMENT NOT NULL,
  not_id INT NOT NULL,
  mc_id INT NOT NULL,
  INDEX nmc_not_id (not_id),
  INDEX nmc_carrier_id (mc_id),
  PRIMARY KEY(nmc_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_notice_log (
  notlog_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  notlog_timestamp BINARY(14) NOT NULL,
  notlog_user_id INT UNSIGNED NOT NULL,
  notlog_action ENUM('created', 'modified', 'removed') DEFAULT 'modified' NOT NULL,
  notlog_not_id INT UNSIGNED NOT NULL,
  notlog_not_name VARCHAR(255) DEFAULT NULL,
  notlog_begin_projects VARCHAR(255) DEFAULT NULL,
  notlog_end_projects VARCHAR(255) DEFAULT NULL,
  notlog_begin_languages TEXT DEFAULT NULL,
  notlog_end_languages TEXT DEFAULT NULL,
  notlog_begin_countries TEXT DEFAULT NULL,
  notlog_end_countries TEXT DEFAULT NULL,
  notlog_begin_regions TEXT DEFAULT NULL,
  notlog_end_regions TEXT DEFAULT NULL,
  notlog_begin_start BINARY(14) DEFAULT NULL,
  notlog_end_start BINARY(14) DEFAULT NULL,
  notlog_begin_end BINARY(14) DEFAULT NULL,
  notlog_end_end BINARY(14) DEFAULT NULL,
  notlog_begin_enabled TINYINT(1) DEFAULT NULL,
  notlog_end_enabled TINYINT(1) DEFAULT NULL,
  notlog_begin_preferred TINYINT(1) DEFAULT NULL,
  notlog_end_preferred TINYINT(1) DEFAULT NULL,
  notlog_begin_throttle INT DEFAULT NULL,
  notlog_end_throttle INT DEFAULT NULL,
  notlog_begin_locked TINYINT(1) DEFAULT NULL,
  notlog_end_locked TINYINT(1) DEFAULT NULL,
  notlog_begin_geo TINYINT(1) DEFAULT NULL,
  notlog_end_geo TINYINT(1) DEFAULT NULL,
  notlog_begin_banners TEXT DEFAULT NULL,
  notlog_end_banners TEXT DEFAULT NULL,
  notlog_begin_buckets TINYINT(1) DEFAULT NULL,
  notlog_end_buckets TINYINT(1) DEFAULT NULL,
  notlog_begin_mobile_carrier INT DEFAULT NULL,
  notlog_end_mobile_carrier INT DEFAULT NULL,
  notlog_begin_weight INT DEFAULT NULL,
  notlog_end_weight INT DEFAULT NULL,
  notlog_begin_archived TINYINT DEFAULT NULL,
  notlog_end_archived TINYINT DEFAULT NULL,
  notlog_begin_mixins BLOB DEFAULT NULL,
  notlog_end_mixins BLOB DEFAULT NULL,
  notlog_comment VARCHAR(255) DEFAULT NULL,
  notlog_begin_type VARCHAR(255) DEFAULT NULL,
  notlog_end_type VARCHAR(255) DEFAULT NULL,
  INDEX notlog_timestamp (notlog_timestamp),
  INDEX notlog_user_id (
    notlog_user_id, notlog_timestamp
  ),
  INDEX notlog_not_id (notlog_not_id, notlog_timestamp),
  PRIMARY KEY(notlog_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/cn_template_log (
  tmplog_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  tmplog_timestamp BINARY(14) NOT NULL,
  tmplog_user_id INT UNSIGNED NOT NULL,
  tmplog_action ENUM('created', 'modified', 'removed') DEFAULT 'modified' NOT NULL,
  tmplog_template_id INT UNSIGNED NOT NULL,
  tmplog_template_name VARCHAR(255) DEFAULT NULL,
  tmplog_begin_anon TINYINT(1) DEFAULT NULL,
  tmplog_end_anon TINYINT(1) DEFAULT NULL,
  tmplog_begin_account TINYINT(1) DEFAULT NULL,
  tmplog_end_account TINYINT(1) DEFAULT NULL,
  tmplog_begin_fundraising TINYINT(1) DEFAULT NULL,
  tmplog_end_fundraising TINYINT(1) DEFAULT NULL,
  tmplog_begin_autolink TINYINT(1) DEFAULT NULL,
  tmplog_end_autolink TINYINT(1) DEFAULT NULL,
  tmplog_begin_landingpages VARCHAR(255) DEFAULT NULL,
  tmplog_end_landingpages VARCHAR(255) DEFAULT NULL,
  tmplog_content_change TINYINT(1) DEFAULT 0,
  tmplog_begin_prioritylangs TEXT DEFAULT NULL,
  tmplog_end_prioritylangs TEXT DEFAULT NULL,
  tmplog_begin_archived TINYINT(1) DEFAULT NULL,
  tmplog_end_archived TINYINT(1) DEFAULT NULL,
  tmplog_begin_category VARCHAR(255) DEFAULT NULL,
  tmplog_end_category VARCHAR(255) DEFAULT NULL,
  tmplog_begin_preview_sandbox TINYINT(1) DEFAULT NULL,
  tmplog_end_preview_sandbox TINYINT(1) DEFAULT NULL,
  tmplog_begin_controller_mixin VARBINARY(4096) DEFAULT NULL,
  tmplog_end_controller_mixin VARBINARY(4096) DEFAULT NULL,
  tmplog_begin_devices VARBINARY(512) DEFAULT NULL,
  tmplog_end_devices VARBINARY(512) DEFAULT NULL,
  tmplog_comment VARCHAR(255) DEFAULT NULL,
  INDEX tmplog_timestamp (tmplog_timestamp),
  INDEX tmplog_user_id (
    tmplog_user_id, tmplog_timestamp
  ),
  INDEX tmplog_template_id (
    tmplog_template_id, tmplog_timestamp
  ),
  PRIMARY KEY(tmplog_id)
) /*$wgDBTableOptions*/;
