Sha256: 03246cd139a46b9cd38acff356987bbc15093b69bf8d1bd99124784b5f9bd26f

Contents?: true

Size: 526 Bytes

Versions: 8

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

class AddFollowableCounterCacheToVotings < ActiveRecord::Migration[5.2]
  class Voting < ApplicationRecord
    self.table_name = :decidim_votings_votings
  end

  def change
    add_column :decidim_votings_votings, :follows_count, :integer, null: false, default: 0, index: true

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb
decidim-elections-0.27.9 db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb
decidim-elections-0.28.3 db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb
decidim-elections-0.27.8 db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb
decidim-elections-0.28.2 db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb
decidim-elections-0.27.7 db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb
decidim-elections-0.28.1 db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb
decidim-elections-0.27.6 db/migrate/20210310120708_add_followable_counter_cache_to_votings.rb