diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index ed9d9d8bc..29f00faed 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -29,11 +29,10 @@ class CreateTicket < ActiveRecord::Migration t.timestamps end add_index :ticket_priorities, [:name], :unique => true - create_table :tickets do |t| t.references :group, :null => false - t.references :ticket_priority, :null => false - t.references :ticket_state, :null => false + 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 @@ -43,21 +42,30 @@ class CreateTicket < ActiveRecord::Migration 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 + t.column :first_response_in_min, :integer, :null => true + t.column :first_response_diff_in_min, :integer, :null => true t.column :close_time, :timestamp, :null => true t.column :close_time_escal_date, :timestamp, :null => true t.column :close_time_sla_time, :timestamp, :null => true + t.column :close_time_in_min, :integer, :null => true + t.column :close_time_diff_in_min, :integer, :null => true + t.column :update_time_escal_date, :timestamp, :null => true + t.column :updtate_time_sla_time, :timestamp, :null => true + t.column :update_time_in_min, :integer, :null => true + t.column :update_time_diff_in_min, :integer, :null => true t.column :last_contact, :timestamp, :null => true t.column :last_contact_agent, :timestamp, :null => true t.column :last_contact_customer, :timestamp, :null => true t.column :create_article_type_id, :integer, :null => true 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 :updated_by_id, :integer, :null => false t.column :created_by_id, :integer, :null => false t.timestamps end - add_index :tickets, [:ticket_state_id] - add_index :tickets, [:ticket_priority_id] + add_index :tickets, [:state_id] + add_index :tickets, [:priority_id] add_index :tickets, [:group_id] add_index :tickets, [:owner_id] add_index :tickets, [:customer_id] @@ -66,8 +74,15 @@ class CreateTicket < ActiveRecord::Migration add_index :tickets, [:created_at] add_index :tickets, [:first_response] add_index :tickets, [:first_response_escal_date] + add_index :tickets, [:first_response_in_min] + add_index :tickets, [:first_response_diff_in_min] add_index :tickets, [:close_time] add_index :tickets, [:close_time_escal_date] + add_index :tickets, [:close_time_in_min] + add_index :tickets, [:close_time_diff_in_min] + add_index :tickets, [:escalation_time] + add_index :tickets, [:update_time_in_min] + add_index :tickets, [:update_time_diff_in_min] add_index :tickets, [:last_contact] add_index :tickets, [:last_contact_agent] add_index :tickets, [:last_contact_customer] @@ -119,9 +134,9 @@ class CreateTicket < ActiveRecord::Migration add_index :ticket_article_senders, [:name], :unique => true create_table :ticket_articles do |t| - t.references :ticket, :null => false - t.references :ticket_article_type, :null => false - t.references :ticket_article_sender, :null => false + t.references :ticket, :null => false + t.references :type, :null => false + t.references :sender, :null => false t.column :from, :string, :limit => 3000, :null => true t.column :to, :string, :limit => 3000, :null => true t.column :cc, :string, :limit => 3000, :null => true @@ -139,12 +154,12 @@ class CreateTicket < ActiveRecord::Migration end add_index :ticket_articles, [:ticket_id] add_index :ticket_articles, [:message_id_md5] - add_index :ticket_articles, [:message_id_md5, :ticket_article_type_id], :name => 'index_ticket_articles_message_id_md5_type_id' + add_index :ticket_articles, [:message_id_md5, :type_id], :name => 'index_ticket_articles_message_id_md5_type_id' add_index :ticket_articles, [:created_by_id] add_index :ticket_articles, [:created_at] add_index :ticket_articles, [:internal] - add_index :ticket_articles, [:ticket_article_type_id] - add_index :ticket_articles, [:ticket_article_sender_id] + add_index :ticket_articles, [:type_id] + add_index :ticket_articles, [:sender_id] create_table :ticket_article_flags do |t| t.references :ticket_articles, :null => false diff --git a/db/migrate/20130201071513_create_sla.rb b/db/migrate/20130201071513_create_sla.rb index 0d570f249..fce0bfbd8 100644 --- a/db/migrate/20130201071513_create_sla.rb +++ b/db/migrate/20130201071513_create_sla.rb @@ -1,15 +1,16 @@ class CreateSla < ActiveRecord::Migration def up create_table :slas do |t| - 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 :data, :string, :limit => 5000, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + 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 :data, :string, :limit => 5000, :null => true + t.column :timezone, :string, :limit => 50, :null => true + t.column :active, :boolean, :null => false, :default => true + t.column :updated_by_id, :integer, :null => false + t.column :created_by_id, :integer, :null => false t.timestamps end add_index :slas, [:name], :unique => true diff --git a/db/migrate/20130219061532_change_ticket_escalation.rb b/db/migrate/20130219061532_change_ticket_escalation.rb deleted file mode 100644 index 87c5686f0..000000000 --- a/db/migrate/20130219061532_change_ticket_escalation.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ChangeTicketEscalation < ActiveRecord::Migration - def up - add_column :tickets, :first_response_in_min, :integer, :null => true - add_column :tickets, :first_response_diff_in_min, :integer, :null => true - add_index :tickets, [:first_response_in_min] - add_index :tickets, [:first_response_diff_in_min] - - add_column :tickets, :close_time_in_min, :integer, :null => true - add_column :tickets, :close_time_diff_in_min, :integer, :null => true - add_index :tickets, [:close_time_in_min] - add_index :tickets, [:close_time_diff_in_min] - end - def down - end -end diff --git a/db/migrate/20130305111945_update_sla.rb b/db/migrate/20130305111945_update_sla.rb deleted file mode 100644 index bba8b93ea..000000000 --- a/db/migrate/20130305111945_update_sla.rb +++ /dev/null @@ -1,10 +0,0 @@ -class UpdateSla < ActiveRecord::Migration - def up - add_column :slas, :first_response_time, :integer, :null => true - add_column :slas, :update_time, :integer, :null => true - add_column :slas, :close_time, :integer, :null => true - end - - def down - end -end diff --git a/db/migrate/20130306224545_change_ticket_escalation2.rb b/db/migrate/20130306224545_change_ticket_escalation2.rb deleted file mode 100644 index 319967f3d..000000000 --- a/db/migrate/20130306224545_change_ticket_escalation2.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ChangeTicketEscalation2 < ActiveRecord::Migration - def up - add_column :tickets, :escalation_time, :timestamp, :null => true - add_index :tickets, [:escalation_time] - end - - def down - end -end diff --git a/db/migrate/20130321124312_ticket_escalation_update_time.rb b/db/migrate/20130321124312_ticket_escalation_update_time.rb deleted file mode 100644 index 2056e5f3e..000000000 --- a/db/migrate/20130321124312_ticket_escalation_update_time.rb +++ /dev/null @@ -1,13 +0,0 @@ -class TicketEscalationUpdateTime < ActiveRecord::Migration - def up - add_column :tickets, :update_time_escal_date, :timestamp, :null => true - add_column :tickets, :updtate_time_sla_time, :timestamp, :null => true - add_column :tickets, :update_time_in_min, :integer, :null => true - add_column :tickets, :update_time_diff_in_min, :integer, :null => true - add_index :tickets, [:update_time_in_min] - add_index :tickets, [:update_time_diff_in_min] - end - - def down - end -end diff --git a/db/migrate/20130606070432_sla_timezone.rb b/db/migrate/20130606070432_sla_timezone.rb deleted file mode 100644 index 495e63175..000000000 --- a/db/migrate/20130606070432_sla_timezone.rb +++ /dev/null @@ -1,9 +0,0 @@ -class SlaTimezone < ActiveRecord::Migration - def up - add_column :slas, :timezone, :string, :limit => 50, :null => true - end - - def down - remove_column :slas, :timezone - end -end diff --git a/db/migrate/20140608000001_update_ticket_replace.rb b/db/migrate/20140608000001_update_ticket_replace.rb deleted file mode 100644 index 4a9a09d1a..000000000 --- a/db/migrate/20140608000001_update_ticket_replace.rb +++ /dev/null @@ -1,12 +0,0 @@ -class UpdateTicketReplace < ActiveRecord::Migration - def up - - rename_column :tickets, :ticket_priority_id, :priority_id - rename_column :tickets, :ticket_state_id, :state_id - rename_column :ticket_articles, :ticket_article_type_id, :type_id - rename_column :ticket_articles, :ticket_article_sender_id, :sender_id - end - - def down - end -end