Sha256: bcf5407f1e15795dcb771aeda837e37ec8bb233dd11f6404b6847ec6d0e87d0d

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

# This migration comes from spree (originally 20130306181701)
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 https://github.com/spree/spree/issues/3115
    country = usa || Spree::Country.first
    Spree::Country.reset_column_information
    Spree::StockLocation.update_all(:country_id => country)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_order_reporting-0.0.2 spec/dummy/db/migrate/20160707103391_add_address_fields_to_stock_location.spree.rb
spree_order_reporting-0.0.1 spec/dummy/db/migrate/20160706112343_add_address_fields_to_stock_location.spree.rb