From 64addce6c60c2580a878670f15f733f59477d98d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 8 Feb 2015 15:25:11 +0000 Subject: [PATCH] Fixed the migration for SQLServer (#18855). git-svn-id: http://svn.redmine.org/redmine/trunk@13990 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- db/migrate/20150208105930_replace_move_issues_permission.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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" ) -- 2.39.5