api_rate_limits table
The api_rate_limits table in the Reddit Clone Database Schema schema has 6 columns.
A fixed-window counter keyed by whoever is being limited - a user, an OAuth application or a bare IP. principal_id is a varchar rather than a uuid precisely because an IP is a legitimate principal.
Columns (6)
| Column | Type | Constraints | Description |
|---|---|---|---|
| principal_type | principal_type | not null | |
| principal_id | varchar(120) | not null | |
| window_started_at | timestamptz | not null | |
| request_count | integer | not null | |
| limit_per_window | integer | not null | |
| throttled_count | integer | not null |