Sha256: 2544d98c65614aaae737933bba2427214b7d0999d3f6f0a2d3ab54761e1269a8

Contents?: true

Size: 513 Bytes

Versions: 6

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-enhanced_textwork-1.0.5 db/migrate/20210310102839_add_followable_counter_cache_to_paragraphs.rb
decidim-enhanced_textwork-1.0.4 db/migrate/20210310102839_add_followable_counter_cache_to_paragraphs.rb
decidim-enhanced_textwork-1.0.3 db/migrate/20210310102839_add_followable_counter_cache_to_paragraphs.rb
decidim-enhanced_textwork-1.0.2 db/migrate/20210310102839_add_followable_counter_cache_to_paragraphs.rb
decidim-enhanced_textwork-1.0.1 db/migrate/20210310102839_add_followable_counter_cache_to_paragraphs.rb
decidim-enhanced_textwork-1.0.0 db/migrate/20210310102839_add_followable_counter_cache_to_paragraphs.rb