peixue-dev/Archive/[一次性]添加user表audit_status字段-2026-01-28.sql

20 lines
646 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.

-- 为user表添加audit_status字段
-- 用于保存陪伴员、管理师等角色的审核状态
-- 检查字段是否已存在,如果不存在则添加
-- ALTER TABLE `user`
-- ADD COLUMN `audit_status` INT DEFAULT 0 COMMENT '审核状态0=待审核,1=已通过,2=未通过'
-- AFTER `status`;
-- 字段已存在,直接更新数据
-- 将现有的正常用户设置为已通过状态
UPDATE `user`
SET `audit_status` = 1
WHERE `status` = 1 AND `user_type` IN ('teacher', 'manager');
-- 查看修改结果
SELECT id, phone, nickname, user_type, status, audit_status
FROM `user`
WHERE `user_type` IN ('teacher', 'manager')
LIMIT 10;