-- --------------------------------------------
-- Mitigator additions changes for responses --
-----------------------------------------------

ALTER TABLE `ic_check` 
DROP COLUMN `completed`,
CHANGE COLUMN `id` `id` INT(11) UNSIGNED NOT NULL,
CHANGE COLUMN `created_by` `created_by` VARCHAR(12) NULL DEFAULT NULL,
ADD COLUMN `positive` TINYINT(1) NOT NULL DEFAULT '0' AFTER `status` ;

SET SQL_SAFE_UPDATES = 0;
	UPDATE `ic_check` 
		SET `positive` = 1 
	WHERE ic_check.id IN (SELECT DISTINCT(ic_response.check_id) FROM ic_response 
		WHERE ic_response.positive = 1);
SET SQL_SAFE_UPDATES = 1;
