Commit e9f52760 authored by jplang's avatar jplang

MySQL: You can't specify target table for update in FROM clause (#23347).

Patch by Felix Schäfer.

git-svn-id: https://svn.redmine.org/redmine/trunk@15737 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 8304df91
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment