CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(256) NOT NULL,
    role INTEGER NOT NULL,
    character VARCHAR(128) NOT NULL,
    color VARCHAR(128) NOT NULL,
    pronouns VARCHAR(128) NOT NULL,

    created_at DATETIME NOT NULL DEFAULT current_timestamp
);

CREATE TABLE IF NOT EXISTS users_hotbar (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id INTEGER,
    key TEXT NOT NULL,
    value TEXT NOT NULL,

    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS users_stats (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id INTEGER,
    core_version TEXT NOT NULL,
    system_id VARCHAR(64) NOT NULL,
    system_version VARCHAR(64) NOT NULL,
    created_time INTEGER NOT NULL,
    modified_time INTEGER NOT NULL,
    last_modified_by VARCHAR(256) NOT NULL,

    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
); 
