CREATE TABLE IF NOT EXISTS users (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  username TEXT UNIQUE NOT NULL,
  password_hash TEXT NOT NULL,
  role TEXT NOT NULL CHECK(role IN ('admin','user')),
  canRunBot INTEGER NOT NULL DEFAULT 0,
  active_machine_id TEXT,
  active_token TEXT,
  last_heartbeat INTEGER,
  created_at TEXT DEFAULT CURRENT_TIMESTAMP
);
