Sha256: c6388be92500c9403a502ad0b85c8c7f8980245aa89d9be11a461e7566c67248

Contents?: true

Size: 533 Bytes

Versions: 41

Compression:

Stored size: 533 Bytes

Contents

# Reset follower_count for all the ActivityObjects that are not Actors
# See: https://github.com/ging/social_stream/issues/274
class FixActivityObjectFollowerCount < ActiveRecord::Migration
  def up
    ActivityObject.record_timestamps = false

    ActivityObject.where("object_type != ?", "Actor").all.each do |ao|
      ao.update_attribute :follower_count, ao.received_actions.where(:follow => true).count
    end

    ActivityObject.record_timestamps = true
    ActivityObject.reset_column_information
  end

  def down
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
social_stream-1.1.12 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.11 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.11 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.10 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.10 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.9 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.9 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.8 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.8 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.7 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.7 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.6 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.6 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.5 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.5 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.4 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.4 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.3 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-base-1.1.3 db/migrate/20120627115244_fix_activity_object_follower_count.rb
social_stream-1.1.2 base/db/migrate/20120627115244_fix_activity_object_follower_count.rb