]> Untitled Git - lemmy.git/blob - server/migrations/2019-12-11-181820_add_site_fields/down.sql
routes.api: fix get_captcha endpoint (#1135)
[lemmy.git] / server / migrations / 2019-12-11-181820_add_site_fields / down.sql
1 -- Drop the columns
2 drop view site_view;
3 alter table site drop column enable_downvotes;
4 alter table site drop column open_registration;
5 alter table site drop column enable_nsfw;
6
7 -- Rebuild the views
8
9 create view site_view as 
10 select *,
11 (select name from user_ u where s.creator_id = u.id) as creator_name,
12 (select count(*) from user_) as number_of_users,
13 (select count(*) from post) as number_of_posts,
14 (select count(*) from comment) as number_of_comments,
15 (select count(*) from community) as number_of_communities
16 from site s;