##// END OF EJS Templates
Fixed the migration for SQLServer (#18855)....
Jean-Philippe Lang -
r13608:64addce6c60c
parent child
Show More
@@ -1,18 +1,19
1 class ReplaceMoveIssuesPermission < ActiveRecord::Migration
1 class ReplaceMoveIssuesPermission < ActiveRecord::Migration
2 def self.up
2 def self.up
3 Role.all.each do |role|
3 Role.all.each do |role|
4 if role.has_permission?(:edit_issues) && !role.has_permission?(:move_issues)
4 if role.has_permission?(:edit_issues) && !role.has_permission?(:move_issues)
5 # inserts one ligne per trakcer and status
5 # inserts one ligne per trakcer and status
6 WorkflowPermission.connection.insert_sql(
6 rule = WorkflowPermission.connection.quote_column_name('rule') # rule is a reserved keyword in SQLServer
7 "INSERT INTO #{WorkflowPermission.table_name} (tracker_id, old_status_id, role_id, type, field_name, rule)" +
7 WorkflowPermission.connection.execute(
8 "INSERT INTO #{WorkflowPermission.table_name} (tracker_id, old_status_id, role_id, type, field_name, #{rule})" +
8 " SELECT t.id, s.id, #{role.id}, 'WorkflowPermission', 'project_id', 'readonly'" +
9 " SELECT t.id, s.id, #{role.id}, 'WorkflowPermission', 'project_id', 'readonly'" +
9 " FROM #{Tracker.table_name} t, #{IssueStatus.table_name} s"
10 " FROM #{Tracker.table_name} t, #{IssueStatus.table_name} s"
10 )
11 )
11 end
12 end
12 end
13 end
13 end
14 end
14
15
15 def self.down
16 def self.down
16 raise IrreversibleMigration
17 raise IrreversibleMigration
17 end
18 end
18 end
19 end
General Comments 0
You need to be logged in to leave comments. Login now