You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.0 KiB

6 months ago
6 months ago
  1. -- 创建 sys_user 表
  2. CREATE TABLE IF NOT EXISTS sys_user (
  3. id INTEGER PRIMARY KEY AUTOINCREMENT,
  4. username TEXT NOT NULL,
  5. nickname TEXT,
  6. password TEXT NOT NULL,
  7. avatar TEXT,
  8. role INTEGER,
  9. is_deleted INTEGER DEFAULT 0,
  10. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  11. update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
  12. );
  13. -- 插入测试数据
  14. INSERT INTO sys_user (username, nickname, password, avatar, role, is_deleted)
  15. VALUES
  16. ('admin', 'Admin', '12345', 'admin.png', 0, 0),
  17. ('john_doe', 'John Doe', 'password123', 'avatar1.png', 1, 0),
  18. ('jane_smith', 'Jane Smith', 'password456', 'avatar2.png', 2, 0);
  19. -- 创建 sys_role 表
  20. CREATE TABLE IF NOT EXISTS sys_role (
  21. id INTEGER PRIMARY KEY AUTOINCREMENT,
  22. name TEXT NOT NULL,
  23. code TEXT NOT NULL,
  24. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  25. update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
  26. );
  27. -- 插入角色数据
  28. INSERT INTO sys_role (name, code)
  29. VALUES
  30. ('管理员', 'ADMIN'),
  31. ('普通用户', 'USER');