From 8c9daded0eb30c19e6058ce23ed9dd275375735f Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 23 Sep 2015 02:14:42 +0200 Subject: [PATCH] Fixed migration. --- db/migrate/20150970000001_update_ticket_state.rb | 7 ------- db/migrate/20150976000001_update_ticket_state2.rb | 12 ++++++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20150976000001_update_ticket_state2.rb diff --git a/db/migrate/20150970000001_update_ticket_state.rb b/db/migrate/20150970000001_update_ticket_state.rb index bb829e90f..fca7d95ba 100644 --- a/db/migrate/20150970000001_update_ticket_state.rb +++ b/db/migrate/20150970000001_update_ticket_state.rb @@ -2,12 +2,5 @@ class UpdateTicketState < ActiveRecord::Migration def up add_column :ticket_states, :ignore_escalation, :boolean, null: false, default: false - return if !Ticket::State.first - Ticket::State.create_or_update( id: 3, name: 'pending reminder', state_type_id: Ticket::StateType.find_by(name: 'pending reminder').id, ignore_escalation: true ) - Ticket::State.create_or_update( id: 4, name: 'closed', state_type_id: Ticket::StateType.find_by(name: 'closed').id, ignore_escalation: true ) - Ticket::State.create_or_update( id: 5, name: 'merged', state_type_id: Ticket::StateType.find_by(name: 'merged').id, ignore_escalation: true ) - Ticket::State.create_or_update( id: 6, name: 'removed', state_type_id: Ticket::StateType.find_by(name: 'removed').id, active: false, ignore_escalation: true ) - Ticket::State.create_or_update( id: 7, name: 'pending close', state_type_id: Ticket::StateType.find_by(name: 'pending action').id, next_state_id: 4, ignore_escalation: true ) - end end diff --git a/db/migrate/20150976000001_update_ticket_state2.rb b/db/migrate/20150976000001_update_ticket_state2.rb new file mode 100644 index 000000000..1a3148d18 --- /dev/null +++ b/db/migrate/20150976000001_update_ticket_state2.rb @@ -0,0 +1,12 @@ +class UpdateTicketState2 < ActiveRecord::Migration + def up + + return if !Ticket::State.first + Ticket::State.create_or_update( id: 3, name: 'pending reminder', state_type_id: Ticket::StateType.find_by(name: 'pending reminder').id, ignore_escalation: true ) + Ticket::State.create_or_update( id: 4, name: 'closed', state_type_id: Ticket::StateType.find_by(name: 'closed').id, ignore_escalation: true ) + Ticket::State.create_or_update( id: 5, name: 'merged', state_type_id: Ticket::StateType.find_by(name: 'merged').id, ignore_escalation: true ) + Ticket::State.create_or_update( id: 6, name: 'removed', state_type_id: Ticket::StateType.find_by(name: 'removed').id, active: false, ignore_escalation: true ) + Ticket::State.create_or_update( id: 7, name: 'pending close', state_type_id: Ticket::StateType.find_by(name: 'pending action').id, next_state_id: 4, ignore_escalation: true ) + + end +end