Sha256: 1c6c8cc2cd411accc5b7c0d6ebe5ef8ff037370880f9822f33b69725cce4806f

Contents?: true

Size: 469 Bytes

Versions: 7

Compression:

Stored size: 469 Bytes

Contents

# This migration comes from spree (originally 20120712172620)
class AddCounterCacheToZoneMembers < ActiveRecord::Migration
  def up
    add_column :spree_zones, :zone_members_count, :integer, :default => 0

    Spree::Zone.reset_column_information
    Spree::Zone.find(:all).each do |zone|
      Spree::Zone.update_counters zone.id, :zone_members_count => zone.zone_members.length
    end
  end

  def down
    remove_column :spree_zones, :zone_members_count
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
spree_mercado_pago_payment_method-0.0.2 spec/dummy/db/migrate/20121121030241_add_counter_cache_to_zone_members.spree.rb
spree_mercado_pago_payment_method-0.1.1 spec/dummy/db/migrate/20121121030241_add_counter_cache_to_zone_members.spree.rb
spree_mercado_pago_payment_method-0.1.0 spec/dummy/db/migrate/20121121030241_add_counter_cache_to_zone_members.spree.rb
datashift_spree-0.3.0 spec/sandbox/db/migrate/20121023154458_add_counter_cache_to_zone_members.spree.rb
datashift_spree-0.2.1 spec/sandbox/db/migrate/20121015151251_add_counter_cache_to_zone_members.spree.rb
datashift_spree-0.2.0 spec/sandbox/db/migrate/20120925192819_add_counter_cache_to_zone_members.spree.rb
datashift_spree-0.1.0 spec/sandbox/db/migrate/20120918081550_add_counter_cache_to_zone_members.spree.rb