From: Jean-Philippe Lang Date: Sun, 8 Feb 2015 15:25:11 +0000 (+0000) Subject: Fixed the migration for SQLServer (#18855). X-Git-Tag: 3.0.0~36 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=64addce6c60c2580a878670f15f733f59477d98d;p=redmine.git Fixed the migration for SQLServer (#18855). git-svn-id: http://svn.redmine.org/redmine/trunk@13990 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/db/migrate/20150208105930_replace_move_issues_permission.rb b/db/migrate/20150208105930_replace_move_issues_permission.rb index 79ed506bc..18578f7da 100644 --- a/db/migrate/20150208105930_replace_move_issues_permission.rb +++ b/db/migrate/20150208105930_replace_move_issues_permission.rb @@ -3,8 +3,9 @@ class ReplaceMoveIssuesPermission < ActiveRecord::Migration Role.all.each do |role| if role.has_permission?(:edit_issues) && !role.has_permission?(:move_issues) # inserts one ligne per trakcer and status - WorkflowPermission.connection.insert_sql( - "INSERT INTO #{WorkflowPermission.table_name} (tracker_id, old_status_id, role_id, type, field_name, rule)" + + rule = WorkflowPermission.connection.quote_column_name('rule') # rule is a reserved keyword in SQLServer + WorkflowPermission.connection.execute( + "INSERT INTO #{WorkflowPermission.table_name} (tracker_id, old_status_id, role_id, type, field_name, #{rule})" + " SELECT t.id, s.id, #{role.id}, 'WorkflowPermission', 'project_id', 'readonly'" + " FROM #{Tracker.table_name} t, #{IssueStatus.table_name} s" )