20150824000001_update_cleanup.rb 733 B

1234567891011121314151617181920212223242526272829
  1. class UpdateCleanup < ActiveRecord::Migration
  2. def up
  3. # delete old entries
  4. Scheduler.create_or_update(
  5. name: 'Delete old online notification entries.',
  6. method: 'OnlineNotification.cleanup',
  7. period: 2.hours,
  8. prio: 2,
  9. active: true,
  10. updated_by_id: 1,
  11. created_by_id: 1,
  12. )
  13. add_index :online_notifications, [:seen]
  14. add_index :online_notifications, [:created_at]
  15. add_index :online_notifications, [:updated_at]
  16. Scheduler.create_or_update(
  17. name: 'Delete old token entries.',
  18. method: 'Token.cleanup',
  19. period: 30.days,
  20. prio: 2,
  21. active: true,
  22. updated_by_id: 1,
  23. created_by_id: 1,
  24. )
  25. add_index :tokens, :persistent
  26. end
  27. end