2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2017-09-08 08:28:34 +00:00
|
|
|
class AddTicketTimeAccounting373 < ActiveRecord::Migration[4.2]
|
2017-01-16 13:34:44 +00:00
|
|
|
def up
|
|
|
|
|
|
|
|
# return if it's a new setup
|
2020-08-03 08:35:43 +00:00
|
|
|
return if !Setting.exists?(name: 'system_init_done')
|
2017-01-16 13:34:44 +00:00
|
|
|
|
2017-01-16 13:41:56 +00:00
|
|
|
drop_table :ticket_time_accounting
|
2017-01-16 13:34:44 +00:00
|
|
|
create_table :ticket_time_accountings do |t|
|
|
|
|
t.references :ticket, null: false
|
|
|
|
t.references :ticket_article, null: true
|
|
|
|
t.column :time_unit, :decimal, precision: 6, scale: 2, null: false
|
|
|
|
t.column :created_by_id, :integer, null: false
|
|
|
|
t.timestamps limit: 3, null: false
|
|
|
|
end
|
|
|
|
add_index :ticket_time_accountings, [:ticket_id]
|
|
|
|
add_index :ticket_time_accountings, [:ticket_article_id]
|
|
|
|
add_index :ticket_time_accountings, [:created_by_id]
|
|
|
|
add_index :ticket_time_accountings, [:time_unit]
|
|
|
|
|
|
|
|
add_column :tickets, :time_unit, :decimal, precision: 6, scale: 2, null: true
|
|
|
|
add_index :tickets, [:time_unit]
|
|
|
|
|
|
|
|
Cache.clear
|
|
|
|
end
|
|
|
|
end
|