-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: schema/abstractSchemaChanges/patch-cusi_case-modify-sic_updated_timestamp-remove_default.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_url_identifier,
  sic_status,
  sic_status_reason,
  sic_created_timestamp,
  sic_updated_timestamp
FROM /*_*/cusi_case;

DROP TABLE /*_*/cusi_case;


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

INSERT INTO /*_*/cusi_case (
  sic_id, sic_url_identifier, sic_status,
  sic_status_reason, sic_created_timestamp,
  sic_updated_timestamp
)
SELECT
  sic_id,
  sic_url_identifier,
  sic_status,
  sic_status_reason,
  sic_created_timestamp,
  sic_updated_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 UNIQUE INDEX sic_status_updated_timestamp_id ON /*_*/cusi_case (
  sic_status, sic_updated_timestamp,
  sic_id
);

CREATE UNIQUE INDEX sic_updated_timestamp_id ON /*_*/cusi_case (sic_updated_timestamp, sic_id);

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