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 RemoveLastLoginFromHistory722 < ActiveRecord::Migration[4.2]
|
2017-02-03 07:56:40 +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-02-03 07:56:40 +00:00
|
|
|
|
|
|
|
history_object = History.object_lookup('User')
|
|
|
|
return if !history_object
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2017-02-03 07:56:40 +00:00
|
|
|
history_attribute = History.attribute_lookup('last_login')
|
|
|
|
return if !history_attribute
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2017-02-03 07:56:40 +00:00
|
|
|
History.where(history_object_id: history_object.id, history_attribute_id: history_attribute.id).delete_all
|
|
|
|
end
|
|
|
|
end
|