diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-08-18 14:58:25 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-08-18 14:58:25 +0000 |
commit | a78c7249029828685173ecd86151fb80546d3032 (patch) | |
tree | 69bda82c2a40b44ddd1c3a855648afecf028d376 /db/migrate | |
parent | f710d594e3b08b58dba1ee17d9efaa6b6d29f9a7 (diff) | |
download | redmine-a78c7249029828685173ecd86151fb80546d3032.tar.gz redmine-a78c7249029828685173ecd86151fb80546d3032.zip |
MySQL: You can't specify target table for update in FROM clause (#23347).
Patch by Felix Schäfer.
git-svn-id: http://svn.redmine.org/redmine/trunk@15737 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20150525103953_clear_estimated_hours_on_parent_issues.rb | 2 |
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" |