1 CREATE TABLE mod_remove_post (
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,
6 removed boolean DEFAULT TRUE,
7 when_ timestamp NOT NULL DEFAULT now()
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()
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,
23 removed boolean DEFAULT TRUE,
24 when_ timestamp NOT NULL DEFAULT now()
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,
32 removed boolean DEFAULT TRUE,
34 when_ timestamp NOT NULL DEFAULT now()
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,
44 banned boolean DEFAULT TRUE,
46 when_ timestamp NOT NULL DEFAULT now()
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,
54 banned boolean DEFAULT TRUE,
56 when_ timestamp NOT NULL DEFAULT now()
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()
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()