Sha256: 93f32754e1d1a419dfc290fee683c898b8de824f3c2da90d1db7e3bca7c9836f

Contents?: true

Size: 407 Bytes

Versions: 1

Compression:

Stored size: 407 Bytes

Contents

class AddBorutusAmountCounterCache < ActiveRecord::Migration[4.2]

  def up
    add_column :borutus_accounts, :borutus_amounts_count, :integer

    Borutus::Account.all.pluck(:id).each do |id|
      Borutus::Account.reset_counters(id, :debit_amounts)
      Borutus::Account.reset_counters(id, :credit_amounts)
    end
  end

  def down
    remove_column :borutus_accounts, :borutus_amounts_count
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
borutus-0.2.3 db/migrate/20191025095830_add_borutus_amount_counter_cache.rb