Sha256: 57a4ce02454aab650541bd5cb267db3d7e00ed06c65e8078ee8bbf2d7dc87cd2

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

class CreateCounties < ActiveRecord::Migration[5.0]
  def up
    return if table_exists?(:us_geo_counties)

    create_table :us_geo_counties, id: false do |t|
      t.string :geoid, primary_key: true, limit: 5, null: false
      t.integer :gnis_id, null: false, index: true
      t.string :cbsa_geoid, null: true, limit: 5, index: true
      t.string :metropolitan_division_geoid, limit: 5, null: true, index: true
      t.string :name, null: false, limit: 60
      t.string :short_name, null: false, limit: 30
      t.string :state_code, null: false, limit: 2, index: true
      t.boolean :central, default: false
      t.string :fips_class_code, null: false, limit: 2
      t.string :time_zone_name, null: true, limit: 30
      t.float :land_area, null: true
      t.float :water_area, null: true
      t.integer :population, null: true
      t.integer :housing_units, null: true
      t.float :lat, null: true
      t.float :lng, null: true
      t.datetime :updated_at, null: false
      t.integer :status, null: false, default: 0, limit: 1
    end

    add_index :us_geo_counties, [:name, :state_code], unique: true
    add_index :us_geo_counties, [:short_name, :state_code], unique: true
  end

  def down
    drop_table :us_geo_counties
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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