CREATE TABLE IF NOT EXISTS runtime_license_state (
  id TEXT PRIMARY KEY,
  installation_id TEXT NOT NULL,
  activation_token TEXT,
  key_prefix TEXT,
  allowed_domain TEXT,
  status TEXT NOT NULL DEFAULT 'UNLICENSED',
  activated_at INTEGER,
  checked_at INTEGER,
  expires_at INTEGER,
  last_reason TEXT,
  updated_at INTEGER NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_runtime_license_installation
ON runtime_license_state(installation_id);
