Sha256: 3509ca4c0c286d3821572d649139f06ae6016c9709de6a0aa79eea02c0830e6d

Contents?: true

Size: 682 Bytes

Versions: 10

Compression:

Stored size: 682 Bytes

Contents

# -*- encoding : utf-8 -*-

class CreateGeoips < ActiveRecord::Migration
  def self.up
    create_table :geoips, id: false do |t|
      t.string :ip_from_string, null: false, limit: 15
      t.string :ip_to_string, null: false, limit: 15
      t.integer :ip_from, null: false, limit: 8
      t.integer :ip_to, null: false, limit: 8
      t.string :country_code, null: false, limit: 2
      t.string :country_name, null: false, limit: 64
    end

    execute "ALTER TABLE geoips ADD CONSTRAINT geoips_pkey PRIMARY KEY(ip_from, ip_to);"

    add_index :geoips, :ip_from, unique: true
    add_index :geoips, :ip_to, unique: true
  end

  def self.down
    drop_table :geoips
  end
end

Version data entries

10 entries across 5 versions & 1 rubygems

Version Path
ip_to_country-0.2.0 test/dummy/db/migrate/001_create_geoips.rb
ip_to_country-0.2.0 lib/generators/geoip/templates/migration.rb
ip_to_country-0.1.0 lib/generators/geoip/templates/migration.rb
ip_to_country-0.1.0 test/dummy/db/migrate/001_create_geoips.rb
ip_to_country-0.0.3 test/dummy/db/migrate/001_create_geoips.rb
ip_to_country-0.0.3 lib/generators/geoip/templates/migration.rb
ip_to_country-0.0.2 test/dummy/db/migrate/001_create_geoips.rb
ip_to_country-0.0.2 lib/generators/geoip/templates/migration.rb
ip_to_country-0.0.1 lib/generators/geoip/templates/migration.rb
ip_to_country-0.0.1 test/dummy/db/migrate/001_create_geoips.rb