Moved table changes to base migration.
This commit is contained in:
parent
f1a7461e6e
commit
3bf33eb891
2 changed files with 29 additions and 46 deletions
|
@ -36,15 +36,22 @@ class CreateTicket < ActiveRecord::Migration
|
||||||
t.references :ticket_state, :null => false
|
t.references :ticket_state, :null => false
|
||||||
t.references :organization, :null => true
|
t.references :organization, :null => true
|
||||||
t.column :number, :string, :limit => 60, :null => false
|
t.column :number, :string, :limit => 60, :null => false
|
||||||
t.column :title, :string, :limit => 250, :null => false
|
t.column :title, :string, :limit => 250,:null => false
|
||||||
t.column :owner_id, :integer, :null => false
|
t.column :owner_id, :integer, :null => false
|
||||||
t.column :customer_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, :timestamp, :null => true
|
||||||
|
t.column :first_response_escal_date, :timestamp, :null => true
|
||||||
|
t.column :first_response_sla_time, :timestamp, :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 :last_contact, :timestamp, :null => true
|
t.column :last_contact, :timestamp, :null => true
|
||||||
t.column :last_contact_agent, :timestamp, :null => true
|
t.column :last_contact_agent, :timestamp, :null => true
|
||||||
t.column :last_contact_customer, :timestamp, :null => true
|
t.column :last_contact_customer, :timestamp, :null => true
|
||||||
t.column :close_time, :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 :updated_by_id, :integer, :null => false
|
t.column :updated_by_id, :integer, :null => false
|
||||||
t.column :created_by_id, :integer, :null => false
|
t.column :created_by_id, :integer, :null => false
|
||||||
t.timestamps
|
t.timestamps
|
||||||
|
@ -58,10 +65,14 @@ class CreateTicket < ActiveRecord::Migration
|
||||||
add_index :tickets, [:title]
|
add_index :tickets, [:title]
|
||||||
add_index :tickets, [:created_at]
|
add_index :tickets, [:created_at]
|
||||||
add_index :tickets, [:first_response]
|
add_index :tickets, [:first_response]
|
||||||
|
add_index :tickets, [:first_response_escal_date]
|
||||||
|
add_index :tickets, [:close_time]
|
||||||
|
add_index :tickets, [:close_time_escal_date]
|
||||||
add_index :tickets, [:last_contact]
|
add_index :tickets, [:last_contact]
|
||||||
add_index :tickets, [:last_contact_agent]
|
add_index :tickets, [:last_contact_agent]
|
||||||
add_index :tickets, [:last_contact_customer]
|
add_index :tickets, [:last_contact_customer]
|
||||||
add_index :tickets, [:close_time]
|
add_index :tickets, [:create_article_type_id]
|
||||||
|
add_index :tickets, [:create_article_sender_id]
|
||||||
add_index :tickets, [:created_by_id]
|
add_index :tickets, [:created_by_id]
|
||||||
|
|
||||||
create_table :ticket_flags do |t|
|
create_table :ticket_flags do |t|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
class TicketExtend < ActiveRecord::Migration
|
|
||||||
def up
|
|
||||||
change_table :tickets do |t|
|
|
||||||
t.column :first_response_escal_date, :timestamp, :null => true
|
|
||||||
t.column :first_response_sla_time, :timestamp, :null => true
|
|
||||||
t.column :close_time_escal_date, :timestamp, :null => true
|
|
||||||
t.column :close_time_sla_time, :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
|
|
||||||
end
|
|
||||||
add_index :tickets, [:first_response_escal_date]
|
|
||||||
add_index :tickets, [:close_time_escal_date]
|
|
||||||
add_index :tickets, [:create_article_type_id]
|
|
||||||
add_index :tickets, [:create_article_sender_id]
|
|
||||||
|
|
||||||
tickets = Ticket.all
|
|
||||||
tickets.each {|t|
|
|
||||||
t.article_count = t.articles.count
|
|
||||||
t.create_article_type_id = t.articles.first.ticket_article_type.id
|
|
||||||
t.create_article_sender_id = t.articles.first.ticket_article_sender.id
|
|
||||||
t.save
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def down
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue