-- 见 sqlite/000018 注释。
CREATE TABLE usage_device_hourly (
  user_id      BIGINT UNSIGNED NOT NULL,
  device_id    BIGINT UNSIGNED NOT NULL,
  hour         BIGINT NOT NULL,
  bytes_up     BIGINT UNSIGNED NOT NULL DEFAULT 0,
  bytes_down   BIGINT UNSIGNED NOT NULL DEFAULT 0,
  minutes_used INT NOT NULL DEFAULT 0,
  PRIMARY KEY (device_id, hour),
  INDEX idx_usage_device_hourly_user (user_id, hour)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
