From aaaf79120df2f1b78fbff14d0f80815c5ad588b4 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 26 Sep 2015 13:32:33 +0200 Subject: [PATCH] Merged migrations. --- db/migrate/20120101000001_create_base.rb | 2 ++ db/migrate/20120101000010_create_ticket.rb | 14 ++++++---- db/migrate/20130726000001_update_session.rb | 9 ------ .../20150521134926_process_pending_tickets.rb | 28 ------------------- db/migrate/20150623145511_session_changes.rb | 24 ---------------- 5 files changed, 11 insertions(+), 66 deletions(-) delete mode 100644 db/migrate/20130726000001_update_session.rb delete mode 100644 db/migrate/20150521134926_process_pending_tickets.rb delete mode 100644 db/migrate/20150623145511_session_changes.rb diff --git a/db/migrate/20120101000001_create_base.rb b/db/migrate/20120101000001_create_base.rb index 877618059..bb9851a1f 100644 --- a/db/migrate/20120101000001_create_base.rb +++ b/db/migrate/20120101000001_create_base.rb @@ -3,11 +3,13 @@ class CreateBase < ActiveRecord::Migration create_table :sessions do |t| t.string :session_id, null: false + t.boolean :persistent, null: true t.text :data t.timestamps end add_index :sessions, :session_id add_index :sessions, :updated_at + add_index :sessions, :persistent create_table :users do |t| t.references :organization, null: true diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index 26a6fd770..571b1be65 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -34,11 +34,11 @@ class CreateTicket < ActiveRecord::Migration t.references :priority, null: false t.references :state, null: false t.references :organization, null: true - t.column :number, :string, limit: 60, null: false - t.column :title, :string, limit: 250, null: false + t.column :number, :string, limit: 60, null: false + t.column :title, :string, limit: 250, null: false t.column :owner_id, :integer, null: false t.column :customer_id, :integer, null: false - t.column :note, :string, limit: 250, null: true + t.column :note, :string, limit: 250, null: true t.column :first_response, :timestamp, null: true t.column :first_response_escal_date, :timestamp, null: true t.column :first_response_sla_time, :timestamp, null: true @@ -60,6 +60,8 @@ class CreateTicket < ActiveRecord::Migration t.column :create_article_sender_id, :integer, null: true t.column :article_count, :integer, null: true t.column :escalation_time, :timestamp, null: true + t.column :pending_time, :timestamp, null: true + t.column :type, :string, limit: 100, null: true t.column :updated_by_id, :integer, null: false t.column :created_by_id, :integer, null: false t.timestamps @@ -89,6 +91,8 @@ class CreateTicket < ActiveRecord::Migration add_index :tickets, [:create_article_type_id] add_index :tickets, [:create_article_sender_id] add_index :tickets, [:created_by_id] + add_index :tickets, [:pending_time] + add_index :tickets, [:type] create_table :ticket_flags do |t| t.references :tickets, null: false @@ -317,11 +321,11 @@ class CreateTicket < ActiveRecord::Migration add_index :channels, [:adapter] create_table :slas do |t| - t.column :name, :string, limit: 150, null: true + t.column :name, :string, limit: 150, null: true t.column :first_response_time, :integer, null: true t.column :update_time, :integer, null: true t.column :close_time, :integer, null: true - t.column :condition, :string, limit: 5000, null: true + t.column :condition, :string, limit: 5000, null: true t.column :data, :string, limit: 5000, null: true t.column :timezone, :string, limit: 50, null: true t.column :active, :boolean, null: false, default: true diff --git a/db/migrate/20130726000001_update_session.rb b/db/migrate/20130726000001_update_session.rb deleted file mode 100644 index 79486193b..000000000 --- a/db/migrate/20130726000001_update_session.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateSession < ActiveRecord::Migration - def up - add_column :sessions, :request_type, :integer, null: true - add_index :sessions, :request_type - end - - def down - end -end diff --git a/db/migrate/20150521134926_process_pending_tickets.rb b/db/migrate/20150521134926_process_pending_tickets.rb deleted file mode 100644 index 375beb905..000000000 --- a/db/migrate/20150521134926_process_pending_tickets.rb +++ /dev/null @@ -1,28 +0,0 @@ -class ProcessPendingTickets < ActiveRecord::Migration - def up - - # fix wrong next_state_id for state 'pending close' - pending_close_state = Ticket::State.find_by( - name: 'pending close', - ) - - if pending_close_state - closed_state = Ticket::State.find_by( - name: 'closed', - ) - pending_close_state.next_state_id = closed_state.id - pending_close_state.save! - end - - # add Ticket.process_pending - Scheduler.create_or_update( - name: 'Process pending tickets', - method: 'Ticket.process_pending', - period: 60 * 15, - prio: 1, - active: true, - updated_by_id: 1, - created_by_id: 1, - ) - end -end diff --git a/db/migrate/20150623145511_session_changes.rb b/db/migrate/20150623145511_session_changes.rb deleted file mode 100644 index 4fd08afd3..000000000 --- a/db/migrate/20150623145511_session_changes.rb +++ /dev/null @@ -1,24 +0,0 @@ -class SessionChanges < ActiveRecord::Migration - def up - - ActiveRecord::SessionStore::Session.delete_all - - remove_index :sessions, :request_type - remove_column :sessions, :request_type - - add_column :sessions, :persistent, :boolean, null: true - add_index :sessions, :persistent - end - - def down - - ActiveRecord::SessionStore::Session.delete_all - - remove_index :sessions, :persistent - remove_column :sessions, :persistent - - add_column :sessions, :request_type, :integer, null: true - add_index :sessions, :request_type - end - -end