Sha256: 43309e84b3ddb35659a937c0f7c75547ad1391431eabfd7328ab8fc5ee8536d8

Contents?: true

Size: 850 Bytes

Versions: 121

Compression:

Stored size: 850 Bytes

Contents

class AddAddressFieldsToStockLocation < ActiveRecord::Migration
  def change
    remove_column :spree_stock_locations, :address_id

    add_column :spree_stock_locations, :address1, :string
    add_column :spree_stock_locations, :address2, :string
    add_column :spree_stock_locations, :city, :string
    add_column :spree_stock_locations, :state_id, :integer
    add_column :spree_stock_locations, :state_name, :string
    add_column :spree_stock_locations, :country_id, :integer
    add_column :spree_stock_locations, :zipcode, :string
    add_column :spree_stock_locations, :phone, :string


    usa = Spree::Country.where(:iso => 'US').first
    # In case USA isn't found.
    # See #3115
    country = usa || Spree::Country.first
    Spree::Country.reset_column_information
    Spree::StockLocation.update_all(:country_id => country)
  end
end

Version data entries

121 entries across 121 versions & 2 rubygems

Version Path
spree_core-3.1.0.rc3 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
spree_core-3.1.0.rc2 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
spree_core-3.1.0.rc1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.0.6 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
spree_core-3.0.8 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
spree_core-3.0.7 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.1.3 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.0.5 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
spree_core-3.0.6.1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
spree_core-3.0.6 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
spree_core-3.0.5 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.0.4 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.1.2 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.0.3 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.1.1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.1.0 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.1.0.pre2 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.1.0.pre1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.1.0.beta1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-1.0.2 db/migrate/20130306181701_add_address_fields_to_stock_location.rb