20170203000001_remove_last_login_from_history_722.rb 468 B

123456789101112131415
  1. class RemoveLastLoginFromHistory722 < ActiveRecord::Migration[4.2]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. history_object = History.object_lookup('User')
  6. return if !history_object
  7. history_attribute = History.attribute_lookup('last_login')
  8. return if !history_attribute
  9. History.where(history_object_id: history_object.id, history_attribute_id: history_attribute.id).delete_all
  10. end
  11. end