diff --git a/initialize/migrate/database/02132_update_verify_config.down.sql b/initialize/migrate/database/02132_update_verify_config.down.sql new file mode 100644 index 0000000..2c66df3 --- /dev/null +++ b/initialize/migrate/database/02132_update_verify_config.down.sql @@ -0,0 +1,17 @@ +-- Rollback: restore old verify configuration fields +INSERT INTO `system` (`category`, `key`, `value`, `type`, `desc`) VALUES + ('verify', 'EnableLoginVerify', 'false', 'bool', 'is enable login verify'), + ('verify', 'EnableRegisterVerify', 'false', 'bool', 'is enable register verify'), + ('verify', 'EnableResetPasswordVerify', 'false', 'bool', 'is enable reset password verify') +ON DUPLICATE KEY UPDATE + `value` = VALUES(`value`), + `desc` = VALUES(`desc`); + +-- Remove new captcha configuration fields +DELETE FROM `system` WHERE `category` = 'verify' AND `key` IN ( + 'CaptchaType', + 'EnableUserLoginCaptcha', + 'EnableUserRegisterCaptcha', + 'EnableAdminLoginCaptcha', + 'EnableUserResetPasswordCaptcha' +); diff --git a/initialize/migrate/database/02132_update_verify_config.up.sql b/initialize/migrate/database/02132_update_verify_config.up.sql new file mode 100644 index 0000000..b6d5137 --- /dev/null +++ b/initialize/migrate/database/02132_update_verify_config.up.sql @@ -0,0 +1,17 @@ +-- Add new captcha configuration fields +INSERT INTO `system` (`category`, `key`, `value`, `type`, `desc`) VALUES + ('verify', 'CaptchaType', 'local', 'string', 'Captcha type: local or turnstile'), + ('verify', 'EnableUserLoginCaptcha', 'false', 'bool', 'Enable captcha for user login'), + ('verify', 'EnableUserRegisterCaptcha', 'false', 'bool', 'Enable captcha for user registration'), + ('verify', 'EnableAdminLoginCaptcha', 'false', 'bool', 'Enable captcha for admin login'), + ('verify', 'EnableUserResetPasswordCaptcha', 'false', 'bool', 'Enable captcha for user reset password') +ON DUPLICATE KEY UPDATE + `value` = VALUES(`value`), + `desc` = VALUES(`desc`); + +-- Remove old verify configuration fields +DELETE FROM `system` WHERE `category` = 'verify' AND `key` IN ( + 'EnableLoginVerify', + 'EnableRegisterVerify', + 'EnableResetPasswordVerify' +);