]> Untitled Git - lemmy.git/blob - migrations/2019-04-07-003142_create_moderation_logs/up.sql
Merge branch 'add-view-helper-functions' of https://github.com/eiknat/lemmy into...
[lemmy.git] / migrations / 2019-04-07-003142_create_moderation_logs / up.sql
1 create table mod_remove_post (
2   id serial primary key,
3   mod_user_id int references user_ on update cascade on delete cascade not null,
4   post_id int references post on update cascade on delete cascade not null,
5   reason text,
6   removed boolean default true,
7   when_ timestamp not null default now()
8 );
9
10 create table mod_lock_post (
11   id serial primary key,
12   mod_user_id int references user_ on update cascade on delete cascade not null,
13   post_id int references post on update cascade on delete cascade not null,
14   locked boolean default true,
15   when_ timestamp not null default now()
16 );
17
18 create table mod_remove_comment (
19   id serial primary key,
20   mod_user_id int references user_ on update cascade on delete cascade not null,
21   comment_id int references comment on update cascade on delete cascade not null,
22   reason text,
23   removed boolean default true,
24   when_ timestamp not null default now()
25 );
26
27 create table mod_remove_community (
28   id serial primary key,
29   mod_user_id int references user_ on update cascade on delete cascade not null,
30   community_id int references community on update cascade on delete cascade not null,
31   reason text,
32   removed boolean default true,
33   expires timestamp,
34   when_ timestamp not null default now()
35 );
36
37 -- TODO make sure you can't ban other mods
38 create table mod_ban_from_community (
39   id serial primary key,
40   mod_user_id int references user_ on update cascade on delete cascade not null,
41   other_user_id int references user_ on update cascade on delete cascade not null,
42   community_id int references community on update cascade on delete cascade not null,
43   reason text,
44   banned boolean default true,
45   expires timestamp,
46   when_ timestamp not null default now()
47 );
48
49 create table mod_ban (
50   id serial primary key,
51   mod_user_id int references user_ on update cascade on delete cascade not null,
52   other_user_id int references user_ on update cascade on delete cascade not null,
53   reason text,
54   banned boolean default true,
55   expires timestamp,
56   when_ timestamp not null default now()
57 );
58
59 create table mod_add_community (
60   id serial primary key,
61   mod_user_id int references user_ on update cascade on delete cascade not null,
62   other_user_id int references user_ on update cascade on delete cascade not null,
63   community_id int references community on update cascade on delete cascade not null,
64   removed boolean default false,
65   when_ timestamp not null default now()
66 );
67
68 -- When removed is false that means kicked
69 create table mod_add (
70   id serial primary key,
71   mod_user_id int references user_ on update cascade on delete cascade not null,
72   other_user_id int references user_ on update cascade on delete cascade not null,
73   removed boolean default false,
74   when_ timestamp not null default now()
75 );
76