Sha256: 792e9d82add8ad11d74abd01d2e22bbf490f13f7fb8801e0797673c6e7d488c2

Contents?: true

Size: 851 Bytes

Versions: 7

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

class AddDemographicsToRegions < ActiveRecord::Migration[5.0]
  def up
    unless column_exists?(:us_geo_regions, :land_area)
      add_column :us_geo_regions, :land_area, :float, null: true
    end

    unless column_exists?(:us_geo_regions, :water_area)
      add_column :us_geo_regions, :water_area, :float, null: true
    end

    unless column_exists?(:us_geo_regions, :population)
      add_column :us_geo_regions, :population, :integer, null: true
    end

    unless column_exists?(:us_geo_regions, :housing_units)
      add_column :us_geo_regions, :housing_units, :integer, null: true
    end
  end

  def down
    remove_column :us_geo_regions, :land_area
    remove_column :us_geo_regions, :water_area
    remove_column :us_geo_regions, :population
    remove_column :us_geo_regions, :housing_units
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
us_geo-2.1.1 db/migrate/20230414000200_add_demographics_to_regions.rb
us_geo-2.1.0 db/migrate/20230414000200_add_demographics_to_regions.rb
us_geo-2.0.4 db/migrate/20230414000200_add_demographics_to_regions.rb
us_geo-2.0.3 db/migrate/20230414000200_add_demographics_to_regions.rb
us_geo-2.0.2 db/migrate/20230414000200_add_demographics_to_regions.rb
us_geo-2.0.1 db/migrate/20230414000200_add_demographics_to_regions.rb
us_geo-2.0.0 db/migrate/20230414000200_add_demographics_to_regions.rb