subreddit_moderators table

The subreddit_moderators table in the Reddit Clone Database Schema schema has 14 columns, with 3 foreign keys to subreddits and users.

Permissions are columns, not an enum, because a moderator holds a SET of them. accepted_at null means the invite is still pending, so an invite and an appointment are the same row at two points in its life. position drives mod list order and therefore seniority in every escalation rule.

Columns (14)

Columns of the subreddit_moderators table
ColumnTypeConstraintsDescription
subreddit_iduuidnot null, references subreddits.id
user_iduuidnot null, references users.id
invited_byuuidreferences users.id
is_full_permissionbooleannot null
can_manage_postsbooleannot null
can_manage_usersbooleannot null
can_manage_configbooleannot null
can_manage_flairbooleannot null
can_manage_mailbooleannot null
can_manage_wikibooleannot null
can_manage_chatbooleannot null
positionsmallintnot null
invited_attimestamptznot null
accepted_attimestamptz

Indexes (2)

  • (user_id)
  • (subreddit_id, position)

Relationships

  • subreddit_moderators.subreddit_id references subreddits.id
  • subreddit_moderators.user_id references users.id
  • subreddit_moderators.invited_by references users.id