-- Rate-Limiting-Zaehler (Fixed-Window pro Benutzer/Schluessel).
CREATE TABLE IF NOT EXISTS rate_limits (
    bucket     VARCHAR(128) NOT NULL PRIMARY KEY,  -- sha256(key):windowStart
    hits       INT NOT NULL DEFAULT 0,
    expires_at DATETIME NOT NULL,
    INDEX idx_rate_expires (expires_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
