Class: GeocoderMaxmindGeoliteCountry

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/geocoder/maxmind/templates/migration/geolite_country.rb

Class Method Summary collapse

Class Method Details

.downObject


14
15
16
# File 'lib/generators/geocoder/maxmind/templates/migration/geolite_country.rb', line 14

def self.down
  drop_table :maxmind_geolite_country
end

.upObject


2
3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/geocoder/maxmind/templates/migration/geolite_country.rb', line 2

def self.up
  create_table :maxmind_geolite_country, id: false do |t|
    t.column :start_ip, :string
    t.column :end_ip, :string
    t.column :start_ip_num, :bigint, null: false
    t.column :end_ip_num, :bigint, null: false
    t.column :country_code, :string, null: false
    t.column :country, :string, null: false
  end
  add_index :maxmind_geolite_country, :start_ip_num, unique: true
end