-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: cs_votes_comment_id_patch.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TEMPORARY TABLE /*_*/__temp__cs_votes AS
SELECT
  cst_v_page_id,
  cst_v_user_id,
  cst_v_vote
FROM /*_*/cs_votes;
DROP TABLE /*_*/cs_votes;


CREATE TABLE /*_*/cs_votes (
    cst_v_comment_id INTEGER UNSIGNED NOT NULL,
    cst_v_user_id INTEGER UNSIGNED NOT NULL,
    cst_v_vote SMALLINT NOT NULL
  );
INSERT INTO /*_*/cs_votes (
    cst_v_comment_id, cst_v_user_id,
    cst_v_vote
  )
SELECT
  cst_v_page_id,
  cst_v_user_id,
  cst_v_vote
FROM
  /*_*/__temp__cs_votes;
DROP TABLE /*_*/__temp__cs_votes;

CREATE UNIQUE INDEX cst_v_index ON /*_*/cs_votes (cst_v_comment_id, cst_v_user_id);
