Sha256: 6a1b41f701139fe41ace5c079dde7c0556ae227bb059f4b5f46f00efe9e6a660

Contents?: true

Size: 885 Bytes

Versions: 21

Compression:

Stored size: 885 Bytes

Contents

class AddAddressFieldsToStockLocation < ActiveRecord::Migration[4.2]
  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

21 entries across 21 versions & 1 rubygems

Version Path
solidus_core-2.3.1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.2.2 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.1.1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.0.3 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.3.0 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.3.0.rc3 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.3.0.rc2 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.3.0.rc1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.3.0.beta1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.0.2 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.2.1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.2.0 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.2.0.rc1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.2.0.beta1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.1.0 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.1.0.rc1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.0.1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.1.0.beta1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.0.0 db/migrate/20130306181701_add_address_fields_to_stock_location.rb
solidus_core-2.0.0.rc1 db/migrate/20130306181701_add_address_fields_to_stock_location.rb