20170116000001_add_ticket_time_accounting_373.rb 1.0 KB

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class AddTicketTimeAccounting373 < ActiveRecord::Migration[4.2]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. drop_table :ticket_time_accounting
  7. create_table :ticket_time_accountings do |t|
  8. t.references :ticket, null: false
  9. t.references :ticket_article, null: true
  10. t.column :time_unit, :decimal, precision: 6, scale: 2, null: false
  11. t.column :created_by_id, :integer, null: false
  12. t.timestamps limit: 3, null: false
  13. end
  14. add_index :ticket_time_accountings, [:ticket_id]
  15. add_index :ticket_time_accountings, [:ticket_article_id]
  16. add_index :ticket_time_accountings, [:created_by_id]
  17. add_index :ticket_time_accountings, [:time_unit]
  18. add_column :tickets, :time_unit, :decimal, precision: 6, scale: 2, null: true
  19. add_index :tickets, [:time_unit]
  20. Rails.cache.clear
  21. end
  22. end