-- M1 Security Fix: Persistent rate limiting events table -- Replaces in-memory DashMap to survive server restarts CREATE TABLE IF NOT EXISTS rate_limit_events ( id BIGSERIAL PRIMARY KEY, key TEXT NOT NULL, window_start TIMESTAMPTZ NOT NULL, count INTEGER NOT NULL DEFAULT 1, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() ); CREATE INDEX IF NOT EXISTS idx_rle_key_window ON rate_limit_events (key, window_start);