summary refs log tree commit diff
diff options
context:
space:
mode:
authorpluralcafe-docker <docker@plural.cafe>2018-08-20 01:59:42 +0000
committerpluralcafe-docker <docker@plural.cafe>2018-08-20 01:59:42 +0000
commit478b4c3198678f6f73620ced4d392bb2ab6504fb (patch)
treecc62eb05fe2d7a60bfdbcdfb0cc78dffcadd32b8
parent9541e2c04565c343740f140b73e8b558bfded120 (diff)
Update view for new status_stats table
-rw-r--r--install.sql13
1 files changed, 12 insertions, 1 deletions
diff --git a/install.sql b/install.sql
index 5fe7c82..4f73907 100644
--- a/install.sql
+++ b/install.sql
@@ -13,13 +13,24 @@ CREATE USER ambassador;
 
 -- Now, create the view that ambassador actually uses
 CREATE VIEW public_toots AS
-  SELECT *
+  SELECT 
+   statuses.id, statuses.reblog_of_id, statuses.account_id,
+   statuses.updated_at, status_stats.favourites_count
     FROM statuses
+    LEFT OUTER JOIN status_stats
+     ON statuses.id = status_stats.status_id
    WHERE visibility = 0
 ;
 
+-- Change 13104 to your ambassador's account ID
+CREATE VIEW blocks_ambassador AS
+  SELECT account_id
+    FROM blocks
+    WHERE target_account_id = 13104;
+
 -- Make sure the role doesn't have access to anything undesireable
 REVOKE ALL FROM ambassador;
 
 -- Let ambassador select from the view
 GRANT SELECT ON public_toots TO ambassador;
+GRANT SELECT ON blocks_ambassador TO ambassador;