-- Apply after schema_account_security.sql. Existing shared locks are preserved -- for both credentials because their original source cannot be distinguished. DELIMITER $$ DROP PROCEDURE IF EXISTS `migrate_account_security_lockout`$$ CREATE PROCEDURE `migrate_account_security_lockout`() BEGIN IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fa_user_security' AND COLUMN_NAME = 'payment_failed_attempts') THEN ALTER TABLE `fa_user_security` ADD COLUMN `payment_failed_attempts` int unsigned NOT NULL DEFAULT 0, ADD COLUMN `payment_locked_until` int unsigned NOT NULL DEFAULT 0; UPDATE `fa_user_security` SET `payment_failed_attempts` = `failed_attempts`, `payment_locked_until` = `locked_until`; END IF; END$$ CALL `migrate_account_security_lockout`()$$ DROP PROCEDURE `migrate_account_security_lockout`$$ DELIMITER ;