2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2017-11-02 09:00:44 +00:00
|
|
|
class LastOwnerUpdate2 < ActiveRecord::Migration[5.1]
|
|
|
|
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-11-02 09:00:44 +00:00
|
|
|
|
|
|
|
# reset assignment_timeout to prevent unwanted things happen
|
|
|
|
Group.all.each do |group|
|
|
|
|
group.assignment_timeout = nil
|
|
|
|
group.save!
|
|
|
|
end
|
|
|
|
|
|
|
|
# check if column already exists
|
|
|
|
if !ActiveRecord::Base.connection.column_exists?(:tickets, :last_owner_update_at)
|
|
|
|
add_column :tickets, :last_owner_update_at, :timestamp, limit: 3, null: true
|
|
|
|
add_index :tickets, [:last_owner_update_at]
|
|
|
|
Ticket.reset_column_information
|
|
|
|
end
|
|
|
|
|
|
|
|
Scheduler.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
name: 'Process auto unassign tickets',
|
|
|
|
method: 'Ticket.process_auto_unassign',
|
|
|
|
period: 10.minutes,
|
|
|
|
prio: 1,
|
|
|
|
active: true,
|
2017-11-02 09:00:44 +00:00
|
|
|
updated_by_id: 1,
|
|
|
|
created_by_id: 1,
|
|
|
|
)
|
2017-11-06 16:55:34 +00:00
|
|
|
Cache.clear
|
2017-11-02 09:00:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|