-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: sql/abstractSchemaChanges/patch-drop-unique-indices.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TEMPORARY TABLE /*_*/__temp__nl_newsletters AS
SELECT
  nl_id,
  nl_name,
  nl_desc,
  nl_main_page_id,
  nl_active,
  nl_subscriber_count
FROM /*_*/nl_newsletters;
DROP TABLE /*_*/nl_newsletters;


CREATE TABLE /*_*/nl_newsletters (
    nl_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
    nl_name VARCHAR(64) NOT NULL,
    nl_desc BLOB DEFAULT NULL,
    nl_main_page_id INTEGER UNSIGNED NOT NULL,
    nl_active SMALLINT DEFAULT 1 NOT NULL,
    nl_subscriber_count INTEGER DEFAULT 0 NOT NULL
  );
INSERT INTO /*_*/nl_newsletters (
    nl_id, nl_name, nl_desc, nl_main_page_id,
    nl_active, nl_subscriber_count
  )
SELECT
  nl_id,
  nl_name,
  nl_desc,
  nl_main_page_id,
  nl_active,
  nl_subscriber_count
FROM
  /*_*/__temp__nl_newsletters;
DROP TABLE /*_*/__temp__nl_newsletters;

CREATE INDEX nl_name ON /*_*/nl_newsletters (nl_name);

CREATE INDEX nl_main_page_active ON /*_*/nl_newsletters (nl_main_page_id, nl_active);

CREATE INDEX nl_active ON /*_*/nl_newsletters (nl_active);

CREATE INDEX nl_active_subscriber_name ON /*_*/nl_newsletters (
    nl_active, nl_subscriber_count, nl_name
  );
