Sha256: d6ecc1e700361da4fffb36450e662860a517e2fd38c7c98e576128bb43fc4406

Contents?: true

Size: 441 Bytes

Versions: 1

Compression:

Stored size: 441 Bytes

Contents

# frozen_string_literal: true

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

1 entries across 1 versions & 1 rubygems

Version Path
gutentag-2.6.0 db/migrate/2_gutentag_cache_counter.rb