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)

Columns of the ban_appeals table
ColumnTypeConstraintsDescription
iduuidprimary key
user_iduuidnot null, references users.id
suspension_iduuidreferences site_suspensions.id
subreddit_ban_iduuidreferences subreddit_bans.id
body_mdvarchar(2000)not null
statusappeal_statusnot null
reviewer_iduuidreferences users.id
decision_notevarchar(1000)
created_attimestamptznot null
reviewed_attimestamptz

Indexes (2)

  • (status, created_at)
  • (user_id, created_at)

Relationships