Files
training/sql/users.sql
2026-07-28 12:52:36 +08:00

16 lines
987 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.

-- 用户表最终结构。
-- 执行前请确认目标数据库、影响范围和备份策略;本文件不会由应用自动执行。
CREATE TABLE IF NOT EXISTS USERS (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '用户主键',
full_name VARCHAR(80) NOT NULL COMMENT '用户姓名',
email VARCHAR(160) NOT NULL COMMENT '用户邮箱,必须唯一',
role VARCHAR(40) NOT NULL COMMENT '用户角色Admin、Manager、Member、Viewer',
status VARCHAR(20) NOT NULL DEFAULT 'ACTIVE' COMMENT '账号状态ACTIVE 或 INACTIVE',
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (id),
UNIQUE KEY uk_users_email (email),
KEY idx_users_full_name (full_name),
KEY idx_users_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='培训项目用户表';