]> source.dussan.org Git - redmine.git/commitdiff
Fixed the migration for SQLServer (#18855).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 8 Feb 2015 15:25:11 +0000 (15:25 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 8 Feb 2015 15:25:11 +0000 (15:25 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13990 e93f8b46-1217-0410-a6f0-8f06a7374b81

db/migrate/20150208105930_replace_move_issues_permission.rb

index 79ed506bc3147f02c804e96a72ff97e16670d87d..18578f7dad1678b72e26bcedcdc490e56045585f 100644 (file)
@@ -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"
         )