From c66ae190375129aa75e0372bc4a20da1058ebc96 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 29 Mar 2019 14:10:36 +0100 Subject: [PATCH] FIX: ensures score is 0 and not null if no associated reviewable_scores --- db/migrate/20190327205525_require_reviewable_scores.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20190327205525_require_reviewable_scores.rb b/db/migrate/20190327205525_require_reviewable_scores.rb index 85ab95f1267..217661eda10 100644 --- a/db/migrate/20190327205525_require_reviewable_scores.rb +++ b/db/migrate/20190327205525_require_reviewable_scores.rb @@ -26,7 +26,7 @@ class RequireReviewableScores < ActiveRecord::Migration[5.2] execute(<<~SQL) UPDATE reviewables SET score = ( - SELECT SUM(score) + SELECT COALESCE(SUM(score), 0) FROM reviewable_scores WHERE reviewable_scores.reviewable_id = reviewables.id )