Sha256: 32c3bb7201d2611876a327831bafa19124c1ed482b55258d806c4b75e4e4ec18

Contents?: true

Size: 1.79 KB

Versions: 21

Compression:

Stored size: 1.79 KB

Contents

class CreateUnidomLocations < ActiveRecord::Migration

  def change

    create_table :unidom_locations, id: :uuid do |t|

      t.references :region, type: :uuid, null: false,
        polymorphic: { null: false, default: '', limit: 200 }

      t.decimal :longitude, null: false, default: 0.0, precision: 10, scale: 6
      t.decimal :latitude,  null: false, default: 0.0, precision: 10, scale: 6

      t.string :postal_address, null: false, default: '', limit: 200
      t.string :postal_code,    null: false, default: '', limit: 20

      t.decimal :minimum_longitude, null: false, default: 0.0, precision: 10, scale: 6
      t.decimal :minimum_latitude,  null: false, default: 0.0, precision: 10, scale: 6
      t.decimal :maximum_longitude, null: false, default: 0.0, precision: 10, scale: 6
      t.decimal :maximum_latitude,  null: false, default: 0.0, precision: 10, scale: 6

      t.column :accuarcy_code, 'char(1)', null: false, default: 'N'

      t.column   :state, 'char(1)', null: false, default: 'C'
      t.datetime :opened_at,        null: false, default: ::Time.utc(1970)
      t.datetime :closed_at,        null: false, default: ::Time.utc(3000)
      t.boolean  :defunct,          null: false, default: false
      t.jsonb    :notation,         null: false, default: {}

      t.timestamps null: false

    end

    add_index :unidom_locations, :region_id
    add_index :unidom_locations, :latitude
    add_index :unidom_locations, :longitude
    add_index :unidom_locations, :minimum_latitude
    add_index :unidom_locations, :minimum_longitude
    add_index :unidom_locations, :maximum_latitude
    add_index :unidom_locations, :maximum_longitude
    add_index :unidom_locations, [ :postal_address, :region_id, :region_type ], unique: true, name: 'index_unidom_locations_on_postal_address_and_region'

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
unidom-geo-1.5.8 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.5.7 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.5.6 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.5.5 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.5.4 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.5.3 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.5.2 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.5.1 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.5 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.4.5 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.4.4 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.4.3 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.4.2 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.4.1 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.4 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.3 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.2 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.1 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.0.1 db/migrate/20010401000000_create_unidom_locations.rb
unidom-geo-1.0 db/migrate/20010401000000_create_unidom_locations.rb