Sha256: b9503f0df78d265f0e1cb35bc0ebc0fe7d95b54a8f0dc40b9db866a79cc0511c
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
class InsertAllowedStatusesForNewIssues < ActiveRecord::Migration def self.up # Adds the default status for all trackers and roles sql = "INSERT INTO #{WorkflowTransition.table_name} (tracker_id, old_status_id, new_status_id, role_id, type)" + " SELECT t.id, 0, t.default_status_id, r.id, 'WorkflowTransition'" + " FROM #{Tracker.table_name} t, #{Role.table_name} r" WorkflowTransition.connection.execute(sql) # Adds other statuses that are reachable with one transition # to preserve previous behaviour as default sql = "INSERT INTO #{WorkflowTransition.table_name} (tracker_id, old_status_id, new_status_id, role_id, type)" + " SELECT t.id, 0, w.new_status_id, w.role_id, 'WorkflowTransition'" + " FROM #{Tracker.table_name} t" + " JOIN #{IssueStatus.table_name} s on s.id = t.default_status_id" + " JOIN #{WorkflowTransition.table_name} w on w.tracker_id = t.id and w.old_status_id = s.id and w.type = 'WorkflowTransition'" + " WHERE w.new_status_id <> t.default_status_id" WorkflowTransition.connection.execute(sql) end def self.down WorkflowTransition.where(:old_status_id => 0).delete_all end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redmine_extensions-0.1.15 | spec/redmine/db/migrate/20150725112753_insert_allowed_statuses_for_new_issues.rb |