
-- 创建 sys_user 表
CREATE TABLE IF NOT EXISTS sys_user (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    username TEXT NOT NULL,
    nickname TEXT,
    password TEXT NOT NULL,
    avatar TEXT,
    role INTEGER,
    is_deleted INTEGER DEFAULT 0,
    create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- 插入测试数据
INSERT INTO sys_user (username, nickname, password, avatar, role, is_deleted)
VALUES
    ('admin', 'Admin', '12345', 'admin.png', 0, 0),
    ('john_doe', 'John Doe', 'password123', 'avatar1.png', 1, 0),
    ('jane_smith', 'Jane Smith', 'password456', 'avatar2.png', 2, 0);


-- 创建 sys_role 表
CREATE TABLE IF NOT EXISTS sys_role (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    code TEXT NOT NULL,
    create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- 插入角色数据
INSERT INTO sys_role (name, code)
VALUES
    ('管理员', 'ADMIN'),
    ('普通用户', 'USER');
