diff options
author | Dessalines <tyhou13@gmx.com> | 2019-04-06 17:58:28 -0700 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-04-06 17:58:28 -0700 |
commit | 3d4872ce108398ba035d2e05882a289b94f6d63d (patch) | |
tree | cba304b0ff489e2531631cb3f5f623a16c25a3e4 /server | |
parent | a61516439406b7884e19d9ae8a1875c728bbe628 (diff) |
adding migrations
Diffstat (limited to 'server')
-rw-r--r-- | server/migrations/2019-04-07-003142_create_moderation_logs/down.sql | 6 | ||||
-rw-r--r-- | server/migrations/2019-04-07-003142_create_moderation_logs/up.sql | 54 |
2 files changed, 60 insertions, 0 deletions
diff --git a/server/migrations/2019-04-07-003142_create_moderation_logs/down.sql b/server/migrations/2019-04-07-003142_create_moderation_logs/down.sql new file mode 100644 index 00000000..15718917 --- /dev/null +++ b/server/migrations/2019-04-07-003142_create_moderation_logs/down.sql @@ -0,0 +1,6 @@ +drop table mod_remove_post; +drop table mod_lock_post; +drop table mod_remove_comment; +drop table mod_remove_community; +drop table mod_ban; +drop table mod_add_mod; diff --git a/server/migrations/2019-04-07-003142_create_moderation_logs/up.sql b/server/migrations/2019-04-07-003142_create_moderation_logs/up.sql new file mode 100644 index 00000000..41929e50 --- /dev/null +++ b/server/migrations/2019-04-07-003142_create_moderation_logs/up.sql @@ -0,0 +1,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() +) |