20170203000001_remove_last_login_from_history_722.rb 545 B

1234567891011121314151617
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class RemoveLastLoginFromHistory722 < 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. history_object = History.object_lookup('User')
  7. return if !history_object
  8. history_attribute = History.attribute_lookup('last_login')
  9. return if !history_attribute
  10. History.where(history_object_id: history_object.id, history_attribute_id: history_attribute.id).delete_all
  11. end
  12. end