1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-10-17 17:01:01 +00:00

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
This commit is contained in:
Jean-Philippe Lang 2016-08-18 14:58:25 +00:00
parent f710d594e3
commit a78c724902

View File

@ -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"