Files
FullAutoWaterCheck/db/create_users.sql
GukSang.Jin a01ae01b28 feat: SQL
2026-01-26 19:15:47 +08:00

22 lines
1.1 KiB
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 `sys_users` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`username` VARCHAR(50) NOT NULL COMMENT '用户名',
`password_hash` VARCHAR(255) NOT NULL COMMENT '密码哈希值',
`salt` VARCHAR(32) NOT NULL COMMENT '盐值',
`user_role` TINYINT NOT NULL DEFAULT 0 COMMENT '用户角色0=普通用户1=管理员',
`status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态0=禁用1=启用',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`last_login_time` DATETIME DEFAULT NULL COMMENT '最后登录时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统用户表';
-- 插入默认管理员账户
-- 用户名: admin
-- 密码: admin123
INSERT INTO `sys_users` (`username`, `password_hash`, `salt`, `user_role`, `status`, `create_time`)
VALUES
('admin', 'n5Z+2zK4E0X6tQhV8K7L9n3P2Z5T6s8=', 'Vb6D9gF3H5jK8mN0pQ2R5tU8wX1z=', 1, 1, NOW());