Sha256: 8026ec352f995e1d555640988f197f8509cbe422ca44bf66fd79effa03161c7f

Contents?: true

Size: 439 Bytes

Versions: 26

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

class AddFollowableCounterCacheToUsers < ActiveRecord::Migration[5.2]
  def change
    add_column :decidim_users, :follows_count, :integer, null: false, default: 0, index: true

    reversible do |dir|
      dir.up do
        Decidim::User.reset_column_information
        Decidim::User.find_each do |record|
          record.class.reset_counters(record.id, :follows)
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
decidim-core-0.25.0.rc2 db/migrate/20210310120640_add_followable_counter_cache_to_users.rb
decidim-core-0.25.0.rc1 db/migrate/20210310120640_add_followable_counter_cache_to_users.rb
decidim-core-0.24.3 db/migrate/20210310120640_add_followable_counter_cache_to_users.rb
decidim-core-0.24.2 db/migrate/20210310120640_add_followable_counter_cache_to_users.rb
decidim-core-0.24.1 db/migrate/20210310120640_add_followable_counter_cache_to_users.rb
decidim-core-0.24.0 db/migrate/20210310120640_add_followable_counter_cache_to_users.rb