Sha256: 007cb8a5ba338357ea2d0ae2204ef4353159c134f75b293b714f964fed2318b2

Contents?: true

Size: 377 Bytes

Versions: 28

Compression:

Stored size: 377 Bytes

Contents

class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
  def self.up
    add_column :tags, :taggings_count, :integer, default: 0

    ActsAsTaggableOn::Tag.reset_column_information
    ActsAsTaggableOn::Tag.find_each do |tag|
      ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
    end
  end

  def self.down
    remove_column :tags, :taggings_count
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
calagator-1.1.0 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
calagator-1.0.0 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
grokus-1.0.0.9 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
grokus-1.0.0.8 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
grokus-1.0.0.7 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
grokus-1.0.0.6 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
grokus-1.0.0.5 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
grokus-1.0.0.3 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
grokus-1.0.0.2 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
grokus-1.0.0.1 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
acts-as-taggable-on-4.0.0 db/migrate/3_add_taggings_counter_cache_to_tags.rb
acts-as-taggable-on-4.0.0.pre db/migrate/3_add_taggings_counter_cache_to_tags.rb
calagator-1.0.0.rc3 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
calagator-1.0.0.rc2 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
calagator-1.0.0.rc1 db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
acts-as-taggable-on-3.5.0 db/migrate/3_add_taggings_counter_cache_to_tags.rb
acts-as-taggable-on-3.4.4 db/migrate/3_add_taggings_counter_cache_to_tags.rb
acts-as-taggable-on-3.4.3 db/migrate/3_add_taggings_counter_cache_to_tags.rb
acts-as-taggable-on-3.4.2 db/migrate/3_add_taggings_counter_cache_to_tags.rb
acts-as-taggable-on-3.4.1 db/migrate/3_add_taggings_counter_cache_to_tags.rb