forked from nutomic/lemmy
81da0853aa
- Adding post editing. Fixes #23 - Making SQL versions of comment and post fetching. Fixes #21 - Starting to add forum categories. #17
16 lines
594 B
SQL
16 lines
594 B
SQL
create view community_view as
|
|
select *,
|
|
(select name from user_ u where c.creator_id = u.id) as creator_name,
|
|
(select count(*) from community_follower cf where cf.community_id = c.id) as number_of_subscribers,
|
|
(select count(*) from post p where p.community_id = c.id) as number_of_posts
|
|
from community c;
|
|
|
|
create view community_moderator_view as
|
|
select *,
|
|
(select name from user_ u where cm.user_id = u.id) as user_name
|
|
from community_moderator cm;
|
|
|
|
create view community_follower_view as
|
|
select *,
|
|
(select name from user_ u where cf.user_id = u.id) as user_name
|
|
from community_follower cf;
|