summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/migrate/20150525103953_clear_estimated_hours_on_parent_issues.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/db/migrate/20150525103953_clear_estimated_hours_on_parent_issues.rb b/db/migrate/20150525103953_clear_estimated_hours_on_parent_issues.rb
index 8eed815f7..c00ada096 100644
--- a/db/migrate/20150525103953_clear_estimated_hours_on_parent_issues.rb
+++ b/db/migrate/20150525103953_clear_estimated_hours_on_parent_issues.rb
@@ -6,7 +6,7 @@ class ClearEstimatedHoursOnParentIssues < ActiveRecord::Migration
def self.down
table_name = Issue.table_name
- leaves_sum_select = "SELECT SUM(leaves.estimated_hours) FROM #{table_name} leaves" +
+ leaves_sum_select = "SELECT SUM(leaves.estimated_hours) FROM (SELECT * FROM #{table_name}) AS leaves" +
" WHERE leaves.root_id = #{table_name}.root_id AND leaves.lft > #{table_name}.lft AND leaves.rgt < #{table_name}.rgt" +
" AND leaves.rgt = leaves.lft + 1"