automod_rules table
The automod_rules table in the Reddit Clone Database Schema schema has 15 columns, keyed by id, with 2 foreign keys to subreddits and users. 2 columns in mod_actions and automod_matches reference it.
AutoMod rules are DATA, not code. A community changes its own filtering without a deploy, rules evaluate in priority order, and match_count tells moderators which rule is actually doing the work and which one has never fired once.
Columns (15)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| subreddit_id | uuid | not null, references subreddits.id | |
| name | varchar(100) | not null | |
| applies_to | rule_scope | not null | |
| field | automod_field | not null | |
| operator | automod_operator | not null | |
| pattern | varchar(1000) | not null | |
| action | automod_action | not null | |
| action_reason | varchar(500) | ||
| comment_reply_md | varchar(2000) | ||
| priority | smallint | not null | |
| is_enabled | boolean | not null | |
| match_count | integer | not null | |
| created_by | uuid | references users.id | |
| updated_at | timestamptz | not null |
Indexes (1)
(subreddit_id, is_enabled, priority)
Relationships
automod_rules.subreddit_idreferencessubreddits.idautomod_rules.created_byreferencesusers.idmod_actions.automod_rule_idreferencesautomod_rulesautomod_matches.rule_idreferencesautomod_rules