-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: repo/sql/abstract/term_store.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE wbt_item_terms (
  wbit_id BIGSERIAL NOT NULL,
  wbit_item_id INT NOT NULL,
  wbit_term_in_lang_id INT NOT NULL,
  PRIMARY KEY(wbit_id)
);

CREATE INDEX wbt_item_terms_item_id ON wbt_item_terms (wbit_item_id);

CREATE UNIQUE INDEX wbt_item_terms_term_in_lang_id_item_id ON wbt_item_terms (
  wbit_term_in_lang_id, wbit_item_id
);


CREATE TABLE wbt_property_terms (
  wbpt_id SERIAL NOT NULL,
  wbpt_property_id INT NOT NULL,
  wbpt_term_in_lang_id INT NOT NULL,
  PRIMARY KEY(wbpt_id)
);

CREATE INDEX wbt_property_terms_property_id ON wbt_property_terms (wbpt_property_id);

CREATE UNIQUE INDEX wbt_property_terms_term_in_lang_id_property_id ON wbt_property_terms (
  wbpt_term_in_lang_id, wbpt_property_id
);


CREATE TABLE wbt_term_in_lang (
  wbtl_id SERIAL NOT NULL,
  wbtl_type_id INT NOT NULL,
  wbtl_text_in_lang_id INT NOT NULL,
  PRIMARY KEY(wbtl_id)
);

CREATE INDEX wbt_term_in_lang_type_id_text_in ON wbt_term_in_lang (wbtl_type_id);

CREATE UNIQUE INDEX wbt_term_in_lang_text_in_lang_id_lang_id ON wbt_term_in_lang (
  wbtl_text_in_lang_id, wbtl_type_id
);


CREATE TABLE wbt_text_in_lang (
  wbxl_id SERIAL NOT NULL,
  wbxl_language TEXT NOT NULL,
  wbxl_text_id INT NOT NULL,
  PRIMARY KEY(wbxl_id)
);

CREATE INDEX wbt_text_in_lang_language ON wbt_text_in_lang (wbxl_language);

CREATE UNIQUE INDEX wbt_text_in_lang_text_id_text_id ON wbt_text_in_lang (wbxl_text_id, wbxl_language);


CREATE TABLE wbt_text (
  wbx_id SERIAL NOT NULL,
  wbx_text TEXT NOT NULL,
  PRIMARY KEY(wbx_id)
);

CREATE UNIQUE INDEX wbt_text_text ON wbt_text (wbx_text);
