-- Run this on your database to enable per-user/per-topic quota limiting for FCM and other APIs.
CREATE TABLE IF NOT EXISTS quota_usage (
  id INT AUTO_INCREMENT PRIMARY KEY,
  key_name VARCHAR(255) NOT NULL,
  period_type VARCHAR(16) NOT NULL,
  period_value VARCHAR(32) NOT NULL,
  count INT UNSIGNED NOT NULL DEFAULT 0,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  UNIQUE KEY uk_key_period (key_name, period_type, period_value)
);
