FIX: ensures score is 0 and not null if no associated reviewable_scores

This commit is contained in:
Joffrey JAFFEUX 2019-03-29 14:10:36 +01:00 committed by Robin Ward
parent b1cb95fc23
commit c66ae19037

View File

@ -26,7 +26,7 @@ class RequireReviewableScores < ActiveRecord::Migration[5.2]
execute(<<~SQL) execute(<<~SQL)
UPDATE reviewables SET score = ( UPDATE reviewables SET score = (
SELECT SUM(score) SELECT COALESCE(SUM(score), 0)
FROM reviewable_scores FROM reviewable_scores
WHERE reviewable_scores.reviewable_id = reviewables.id WHERE reviewable_scores.reviewable_id = reviewables.id
) )