]> Untitled Git - lemmy.git/blob - server/migrations/2019-12-11-181820_add_site_fields/up.sql
e107b1ac3cae37fcaedd64531d143795823c39c8
[lemmy.git] / server / migrations / 2019-12-11-181820_add_site_fields / up.sql
1 -- Add the column
2 alter table site add column enable_downvotes boolean default true not null;
3 alter table site add column open_registration boolean default true not null;
4 alter table site add column enable_nsfw boolean default true not null;
5
6 -- Reload the view
7 drop view site_view;
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;