diff options
author | Dessalines <tyhou13@gmx.com> | 2019-08-28 21:28:06 -0700 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-08-28 21:28:06 -0700 |
commit | b50ae1dafc7c34029809f6af252ca4886b0f8414 (patch) | |
tree | 12756ddbe6a8f01f2cfde2f3da345ade71863314 /server/migrations | |
parent | de8c2198afb61ae45d2210125c67a49422b9a2e8 (diff) |
Showing community count on main sidebar
- Fixes #232
Diffstat (limited to 'server/migrations')
-rw-r--r-- | server/migrations/2019-08-29-040006_add_community_count/down.sql | 9 | ||||
-rw-r--r-- | server/migrations/2019-08-29-040006_add_community_count/up.sql | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/server/migrations/2019-08-29-040006_add_community_count/down.sql b/server/migrations/2019-08-29-040006_add_community_count/down.sql new file mode 100644 index 00000000..6302f267 --- /dev/null +++ b/server/migrations/2019-08-29-040006_add_community_count/down.sql @@ -0,0 +1,9 @@ +drop view site_view; + +create view site_view as +select *, +(select name from user_ u where s.creator_id = u.id) as creator_name, +(select count(*) from user_) as number_of_users, +(select count(*) from post) as number_of_posts, +(select count(*) from comment) as number_of_comments +from site s; diff --git a/server/migrations/2019-08-29-040006_add_community_count/up.sql b/server/migrations/2019-08-29-040006_add_community_count/up.sql new file mode 100644 index 00000000..0ec1c9c3 --- /dev/null +++ b/server/migrations/2019-08-29-040006_add_community_count/up.sql @@ -0,0 +1,10 @@ +drop view site_view; + +create view site_view as +select *, +(select name from user_ u where s.creator_id = u.id) as creator_name, +(select count(*) from user_) as number_of_users, +(select count(*) from post) as number_of_posts, +(select count(*) from comment) as number_of_comments, +(select count(*) from community) as number_of_communities +from site s; |