20150403192408_remove_deleted_aspects_from_auto_follow_back.rb 334 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
class RemoveDeletedAspectsFromAutoFollowBack < ActiveRecord::Migration
  def up
    User.where.not(auto_follow_back_aspect_id: Aspect.select(:id))
      .where(auto_follow_back: true)
      .update_all(auto_follow_back: false, auto_follow_back_aspect_id: nil)
  end

  def down
    raise ActiveRecord::IrreversibleMigration
  end
end