-- Database export: rust
-- Date: 2026-07-28 17:51:45
-- Generated by DBX

SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS `sys_user`;

CREATE TABLE `sys_user` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `nick_name` varchar(64) NOT NULL DEFAULT '' COMMENT '昵称',
  `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '头像',
  `user_name` varchar(64) NOT NULL DEFAULT '' COMMENT '用户名',
  `password` varchar(128) NOT NULL DEFAULT '' COMMENT '密码',
  `email` varchar(128) NOT NULL DEFAULT '' COMMENT '邮箱',
  `phone` varchar(32) NOT NULL DEFAULT '' COMMENT '手机号',
  `age` bigint(20) NOT NULL DEFAULT '0' COMMENT '年龄',
  `sex` bigint(20) NOT NULL DEFAULT '0' COMMENT '性别 0未知 1男 2女',
  `creater` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建人ID',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_user_name` (`user_name`),
  KEY `idx_nick_name` (`nick_name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='系统用户表';

INSERT INTO `sys_user` (`id`, `nick_name`, `avatar`, `user_name`, `password`, `email`, `phone`, `age`, `sex`, `creater`, `create_time`) VALUES
(1, '管理员', '', 'admin', '123456', 'wu434425608@163.com', '18866668888', 18, 1, 1, '2026-07-27 14:37:35'),
(2, '用户', '', 'user', '123456', '122', '1', 0, 0, 0, '2026-07-27 07:20:45');

DROP TABLE IF EXISTS `sys_role`;

CREATE TABLE `sys_role` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `role_key` varchar(50) DEFAULT '',
  `role_name` varchar(50) DEFAULT '',
  `sort` int(11) DEFAULT '0',
  `creater` bigint(20) DEFAULT '0',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='系统角色';

INSERT INTO `sys_role` (`id`, `role_key`, `role_name`, `sort`, `creater`, `create_time`) VALUES
(1, 'admin', '管理员', 10, 0, '2026-07-28 09:25:19'),
(3, 'user', '用户', 30, 0, '2026-07-28 09:32:13');

SET FOREIGN_KEY_CHECKS = 1;
