Sha256: d8b993b22ee8174b34c81bc98efddc0eadc1c9e35c05331717fde36eceba5d4f

Contents?: true

Size: 535 Bytes

Versions: 4

Compression:

Stored size: 535 Bytes

Contents

class AddLongLatToAddress < ActiveRecord::Migration
  def up
    unless columns(:postal_addresses).collect {|c| c.name}.include?('latitude')
      add_column :postal_addresses, :latitude, :decimal, :precision => 12, :scale => 8
      add_column :postal_addresses, :longitude, :decimal, :precision => 12, :scale => 8
    end
  end

  def down
    if columns(:postal_addresses).collect {|c| c.name}.include?('latitude')
      remove_column :postal_addresses, :latitude
      remove_column :postal_addresses, :longitude
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
erp_base_erp_svcs-4.0.0 db/migrate/20130411125210_add_long_lat_to_address.rb
erp_base_erp_svcs-3.1.5 db/migrate/20130411125210_add_long_lat_to_address.rb
erp_base_erp_svcs-3.1.4 db/migrate/20130411125210_add_long_lat_to_address.rb
erp_base_erp_svcs-3.1.3 db/migrate/20130411125210_add_long_lat_to_address.rb