Files
dafuweng-saiadmin6.x/server/db/sa_system_user_add_agent_id.sql
2026-04-28 10:24:01 +08:00

10 lines
444 B
SQL
Raw 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.
-- 为 sa_system_user 表新增 agent_id 字段
-- agent_id = md5(id),保证唯一,用于外部系统标识用户
ALTER TABLE `sa_system_user`
ADD COLUMN `agent_id` varchar(32) NULL DEFAULT NULL COMMENT '代理标识md5(id)唯一' AFTER `id`,
ADD UNIQUE INDEX `uk_agent_id`(`agent_id`) USING BTREE;
-- 为已有数据回填 agent_id
UPDATE `sa_system_user` SET `agent_id` = MD5(id) WHERE `agent_id` IS NULL OR `agent_id` = '';