admin/sql/migrate_user_is_enabled.sql
zzh e85dfb80b5
All checks were successful
Build and Deploy / deploy (push) Successful in 1m1s
feat: 仓配开放 API 与后台用户启停
新增 warehouseOpenApi(Token/入库/件重尺/红外图),并在 fk_user 支持 IsEnabled 禁用登录。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 17:53:00 +08:00

25 lines
714 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 后台用户启用/禁用(可重复执行)。
-- 表名:fk_user(Fake RBAC)。默认启用;禁用后拒绝账号密码登录与仓配 Token 换取。
SET @db := DATABASE();
SET @exists := (
SELECT COUNT(1)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db
AND TABLE_NAME = 'fk_user'
AND COLUMN_NAME = 'IsEnabled'
);
SET @sql := IF(
@exists = 0,
'ALTER TABLE `fk_user` ADD COLUMN `IsEnabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT ''是否启用:1启用 0禁用'' AFTER `IsDeleted`',
'SELECT ''fk_user.IsEnabled already exists'' AS info'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
UPDATE `fk_user` SET `IsEnabled` = 1 WHERE `IsEnabled` IS NULL;