ban_appeals table
The ban_appeals table in the Reddit Clone Database Schema schema has 10 columns, keyed by id, with 4 foreign keys to users, site_suspensions and subreddit_bans.
Exactly one of the two sanction columns is set, enforced by a check. Keeping appeals in their own table is what lets an overturned ban leave both the original row and the reversal in the record.
Columns (10)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| user_id | uuid | not null, references users.id | |
| suspension_id | uuid | references site_suspensions.id | |
| subreddit_ban_id | uuid | references subreddit_bans.id | |
| body_md | varchar(2000) | not null | |
| status | appeal_status | not null | |
| reviewer_id | uuid | references users.id | |
| decision_note | varchar(1000) | ||
| created_at | timestamptz | not null | |
| reviewed_at | timestamptz |
Indexes (2)
(status, created_at)(user_id, created_at)
Relationships
ban_appeals.user_idreferencesusers.idban_appeals.suspension_idreferencessite_suspensions.idban_appeals.subreddit_ban_idreferencessubreddit_bans.idban_appeals.reviewer_idreferencesusers.id