summaryrefslogtreecommitdiffstats
path: root/server/migrations/2019-04-07-003142_create_moderation_logs/up.sql
blob: 41929e50ffd9025aacf0f02af49e8da86f39875c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
create table mod_remove_post (
  id serial primary key,
  mod_user_id int references user_ on update cascade on delete cascade not null,
  post_id int references post on update cascade on delete cascade not null,
  reason text,
  removed boolean default true,
  when_ timestamp not null default now()
);

create table mod_lock_post (
  id serial primary key,
  mod_user_id int references user_ on update cascade on delete cascade not null,
  post_id int references post on update cascade on delete cascade not null,
  when_ timestamp not null default now()
);

create table mod_remove_comment (
  id serial primary key,
  mod_user_id int references user_ on update cascade on delete cascade not null,
  comment_id int references comment on update cascade on delete cascade not null,
  reason text,
  removed boolean default true,
  when_ timestamp not null default now()
);

create table mod_remove_community (
  id serial primary key,
  mod_user_id int references user_ on update cascade on delete cascade not null,
  community_id int references community on update cascade on delete cascade not null,
  reason text,
  removed boolean default true,
  when_ timestamp not null default now()
);

-- TODO make sure you can't ban other mods
create table mod_ban (
  id serial primary key,
  mod_user_id int references user_ on update cascade on delete cascade not null,
  other_user_id int references user_ on update cascade on delete cascade not null,
  reason text,
  removed boolean default true,
  expires timestamp,
  when_ timestamp not null default now()
);

-- When removed is false that means kicked
create table mod_add_mod (
  id serial primary key,
  mod_user_id int references user_ on update cascade on delete cascade not null,
  other_user_id int references user_ on update cascade on delete cascade not null,
  removed boolean default false,
  when_ timestamp not null default now()
)