Sha256: 167b52f78e7b0e9e6f3da02d64f99c3f09f1d8290e394f87320bf89429967d78

Contents?: true

Size: 410 Bytes

Versions: 5

Compression:

Stored size: 410 Bytes

Contents

class GutentagCacheCounter < ActiveRecord::Migration
  def up
    add_column :gutentag_tags, :taggings_count, :integer, :default => 0
    add_index  :gutentag_tags, :taggings_count

    Gutentag::Tag.reset_column_information
    Gutentag::Tag.pluck(:id).each do |tag_id|
      Gutentag::Tag.reset_counters tag_id, :taggings
    end
  end

  def down
    remove_column :gutentag_tags, :taggings_count
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gutentag-0.8.0 db/migrate/2_gutentag_cache_counter.rb
gutentag-0.7.0 db/migrate/2_gutentag_cache_counter.rb
gutentag-0.6.0 db/migrate/2_gutentag_cache_counter.rb
gutentag-0.5.1 db/migrate/2_gutentag_cache_counter.rb
gutentag-0.5.0 db/migrate/2_gutentag_cache_counter.rb