DROP PROCEDURE IF EXISTS makeSecure; DELIMITER $$$ CREATE PROCEDURE makeSecure(_isSecure ENUM('y', 'n')) not deterministic modifies sql data BEGIN IF _isSecure = 'y' THEN ALTER TABLE `pl_Page` CHANGE `isSecure` `isSecure` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'y'; ALTER TABLE `pl_DraftPage` CHANGE `isSecure` `isSecure` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'y'; ELSEIF _isSecure = 'n' THEN ALTER TABLE `pl_Page` CHANGE `isSecure` `isSecure` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'n'; ALTER TABLE `pl_DraftPage` CHANGE `isSecure` `isSecure` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'n'; ELSE SIGNAL SQLSTATE 'ERR0R' SET MESSAGE_TEXT = "Incorrect isSecure argument. Use CALL makeSecure('y') or CALL makeSecure('n')", MYSQL_ERRNO = 1; END IF; UPDATE `pl_Page` SET `isSecure` = _isSecure; UPDATE `pl_DraftPage` SET `isSecure` = _isSecure; UPDATE `pl_DPageOption` SET `value` = _isSecure WHERE `name` = 'isSecure'; UPDATE `pl_PageOption` SET `value` = _isSecure WHERE `name` = 'isSecure'; UPDATE `pl_DraftPageOption` SET `value` = _isSecure WHERE `name` = 'isSecure'; END $$$ DELIMITER ;