2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2019-11-13 07:03:47 +00:00
|
|
|
class CreateActiveJobLocks < ActiveRecord::Migration[5.2]
|
|
|
|
def change
|
|
|
|
# return if it's a new setup
|
2020-08-03 08:35:43 +00:00
|
|
|
return if !Setting.exists?(name: 'system_init_done')
|
2019-11-13 07:03:47 +00:00
|
|
|
|
|
|
|
create_table :active_job_locks do |t|
|
|
|
|
t.string :lock_key
|
|
|
|
t.string :active_job_id
|
|
|
|
|
2020-10-27 09:37:21 +00:00
|
|
|
t.timestamps # rubocop:disable Zammad/ExistsDateTimePrecision
|
2019-11-13 07:03:47 +00:00
|
|
|
end
|
|
|
|
add_index :active_job_locks, :lock_key, unique: true
|
|
|
|
add_index :active_job_locks, :active_job_id, unique: true
|
|
|
|
end
|
|
|
|
end
|