Sha256: cdb704e2389133b5b5df5ad12ccd747d07c6dbc22763f2481bba66af7e869d2c

Contents?: true

Size: 452 Bytes

Versions: 122

Compression:

Stored size: 452 Bytes

Contents

# This migration comes from acts_as_taggable_on_engine (originally 3)
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2]
  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

122 entries across 122 versions & 4 rubygems

Version Path
blacklight-spotlight-1.0.0.alpha2 db/migrate/20150410180014_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
blacklight-spotlight-1.0.0.alpha1 db/migrate/20150410180014_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb