Skip to main content

rate_limit_config

Overview

The rate_limit_config table defines the rate limiting rules for each action type. Each row specifies how many actions are allowed within a given time window. Different account tiers can have different limits via the tier_overrides JSONB field.

Schema

-- From 20260205_rate_limiting_fixed.sql
CREATE TABLE rate_limit_config (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
action_type TEXT UNIQUE NOT NULL,
max_actions INTEGER NOT NULL,
window_seconds INTEGER NOT NULL,
tier_overrides JSONB DEFAULT '{}',
description TEXT,
created_at TIMESTAMPTZ DEFAULT NOW()
);

Columns

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
action_typetextNo--Action identifier (unique)
max_actionsintegerNo--Maximum actions per window
window_secondsintegerNo--Window duration in seconds
tier_overridesjsonbNo'{}'Per-tier limit overrides
descriptiontextYes--Human-readable description
created_attimestamptzNoNOW()Configuration creation timestamp

RLS Policies

-- SELECT: All authenticated users can read config (needed for client-side display)
CREATE POLICY "Rate limit config is readable"
ON rate_limit_config FOR SELECT
USING (true);
  • rate_limits -- Per-user rate tracking using this config

Last updated: 2026-02-07