Sha256: 55affb451aeaeaf0c3fd49123cb51aa759370293930203e9362c856bf65b01b8

Contents?: true

Size: 678 Bytes

Versions: 6

Compression:

Stored size: 678 Bytes

Contents

# frozen_string_literal: true

class AddCommentableCounterCacheToParagraphs < ActiveRecord::Migration[5.2]
  def change
    add_column :decidim_enhanced_textwork_paragraphs, :comments_count, :integer, null: false, default: 0, index: true
    add_column :decidim_enhanced_textwork_collaborative_drafts, :comments_count, :integer, null: false, default: 0, index: true
    Decidim::EnhancedTextwork::Paragraph.reset_column_information
    Decidim::EnhancedTextwork::Paragraph.find_each(&:update_comments_count)
    Decidim::EnhancedTextwork::CollaborativeDraft.reset_column_information
    Decidim::EnhancedTextwork::CollaborativeDraft.find_each(&:update_comments_count)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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