| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
CREATE TABLE moderation_actions ( |
| 5 |
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), |
| 6 |
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, |
| 7 |
admin_id UUID NOT NULL REFERENCES users(id), |
| 8 |
action_type VARCHAR(20) NOT NULL |
| 9 |
CHECK (action_type IN ('warning', 'content_removal', 'suspension', 'termination')), |
| 10 |
reason TEXT NOT NULL, |
| 11 |
|
| 12 |
content_ref VARCHAR(255), |
| 13 |
|
| 14 |
resolved_at TIMESTAMPTZ, |
| 15 |
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() |
| 16 |
); |
| 17 |
|
| 18 |
CREATE INDEX idx_moderation_actions_user ON moderation_actions(user_id, created_at DESC); |
| 19 |
CREATE INDEX idx_moderation_actions_active ON moderation_actions(user_id) WHERE resolved_at IS NULL; |
| 20 |
|