Sha256: 9fe514ebf5fbb6eadd38aea98be757f8bf9191a251f2a2cd85c0cea5bb56d21f

Contents?: true

Size: 446 Bytes

Versions: 2

Compression:

Stored size: 446 Bytes

Contents

# frozen_string_literal: true

class GutentagCacheCounter < ActiveRecord::Migration[4.2]
  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

2 entries across 2 versions & 1 rubygems

Version Path
gutentag-2.6.2 db/migrate/2_gutentag_cache_counter.rb
gutentag-2.6.1 db/migrate/2_gutentag_cache_counter.rb