From ac583fce215ff5951b06d3a3da6df397c300df40 Mon Sep 17 00:00:00 2001
From: Claire <claire.github-309c@sitedethib.com>
Date: Sun, 30 Jan 2022 21:38:54 +0100
Subject: Fix some old migration scripts (#17394)

* Fix some old migration scripts

* Fix edge case in two-step migration from older releases
---
 db/views/follow_recommendations_v01.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'db/views/follow_recommendations_v01.sql')

diff --git a/db/views/follow_recommendations_v01.sql b/db/views/follow_recommendations_v01.sql
index 799abeaee..8295bbc0f 100644
--- a/db/views/follow_recommendations_v01.sql
+++ b/db/views/follow_recommendations_v01.sql
@@ -20,7 +20,7 @@ FROM (
   HAVING count(follows.id) >= 5
   UNION ALL
   SELECT accounts.id AS account_id,
-         sum(reblogs_count + favourites_count) / (1.0 + sum(reblogs_count + favourites_count)) AS rank,
+         sum(status_stats.reblogs_count + status_stats.favourites_count) / (1.0 + sum(status_stats.reblogs_count + status_stats.favourites_count)) AS rank,
          'most_interactions' AS reason
   FROM status_stats
   INNER JOIN statuses ON statuses.id = status_stats.status_id
@@ -32,7 +32,7 @@ FROM (
     AND accounts.locked = 'f'
     AND accounts.discoverable = 't'
   GROUP BY accounts.id
-  HAVING sum(reblogs_count + favourites_count) >= 5
+  HAVING sum(status_stats.reblogs_count + status_stats.favourites_count) >= 5
 ) t0
 GROUP BY account_id
 ORDER BY rank DESC
-- 
cgit 

