CREATE TABLE IF NOT EXISTS public.stats (
  device_id TEXT NOT NULL,
  inc_traffic INT NOT NULL DEFAULT 0,
  out_traffic INT NOT NULL DEFAULT 0,
  inc_rps INT NOT NULL DEFAULT 0,
  read_rps INT NOT NULL DEFAULT 0,
  write_rps INT NOT NULL DEFAULT 0,
  updated_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW()
);

CREATE UNIQUE INDEX IF NOT EXISTS
  stats_by_device_id_idx ON public.stats(device_id);

