lemmy/server/migrations/2019-02-27-170003_create_community/up.sql
Dessalines ba5c93c8da Adding forum / community pages
- Adding main forum page. Fixes #11
- Adding view version for posts. #21
- Got rid of fedi user ids. Fixes #22
- Post sorting working. Fixes #24
2019-04-02 23:49:32 -07:00

23 lines
840 B
SQL

create table community (
id serial primary key,
name varchar(20) not null unique,
creator_id int references user_ on update cascade on delete cascade not null,
published timestamp not null default now(),
updated timestamp
);
create table community_moderator (
id serial primary key,
community_id int references community on update cascade on delete cascade not null,
user_id int references user_ on update cascade on delete cascade not null,
published timestamp not null default now()
);
create table community_follower (
id serial primary key,
community_id int references community on update cascade on delete cascade not null,
user_id int references user_ on update cascade on delete cascade not null,
published timestamp not null default now()
);
insert into community (name, creator_id) values ('main', 1);