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 `md_zz_Page` CHANGE `isSecure` `isSecure` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'y'; ALTER TABLE `md_zz_DraftPage` CHANGE `isSecure` `isSecure` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'y'; ELSEIF _isSecure = 'n' THEN ALTER TABLE `md_zz_Page` CHANGE `isSecure` `isSecure` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'n'; ALTER TABLE `md_zz_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 `md_zz_Page` SET `isSecure` = _isSecure; UPDATE `md_zz_DraftPage` SET `isSecure` = _isSecure; UPDATE `md_zz_DPageOption` SET `value` = _isSecure WHERE `name` = 'isSecure'; UPDATE `md_zz_PageOption` SET `value` = _isSecure WHERE `name` = 'isSecure'; UPDATE `md_zz_DraftPageOption` SET `value` = _isSecure WHERE `name` = 'isSecure'; END $$$ DELIMITER ; CALL makeSecure('y'); DROP PROCEDURE IF EXISTS makeSecure;