-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: schema/abstractSchemaChanges/patch-cusi_case-add-sic_url_identifier.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TEMPORARY TABLE /*_*/__temp__cusi_case AS
SELECT
  sic_id,
  sic_status,
  sic_status_reason,
  sic_created_timestamp
FROM /*_*/cusi_case;

DROP TABLE /*_*/cusi_case;


CREATE TABLE /*_*/cusi_case (
  sic_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
  sic_status SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
  sic_status_reason BLOB DEFAULT '' NOT NULL,
  sic_created_timestamp BLOB NOT NULL,
  sic_url_identifier INTEGER UNSIGNED DEFAULT 0 NOT NULL
);

INSERT INTO /*_*/cusi_case (
  sic_id, sic_status, sic_status_reason,
  sic_created_timestamp
)
SELECT
  sic_id,
  sic_status,
  sic_status_reason,
  sic_created_timestamp
FROM
  /*_*/__temp__cusi_case;

DROP TABLE /*_*/__temp__cusi_case;

CREATE UNIQUE INDEX sic_status_created_timestamp_id ON /*_*/cusi_case (
  sic_status, sic_created_timestamp,
  sic_id
);

CREATE UNIQUE INDEX sic_created_timestamp_id ON /*_*/cusi_case (sic_created_timestamp, sic_id);

CREATE INDEX sic_url_identifier ON /*_*/cusi_case (sic_url_identifier);
