From 58e0cf2e90f7637db1114190146e6de6549cebc6 Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Thu, 11 Sep 2014 09:40:54 -0400
Subject: [PATCH] Add indices for faster queries.

See: https://github.com/alexreisner/geocoder/issues/703
---
 .../geocoder/maxmind/templates/migration/geolite_city.rb        | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb b/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb
index 73c93e10..bf875206 100644
--- a/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb
+++ b/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb
@@ -5,7 +5,9 @@ class GeocoderMaxmindGeoliteCity < ActiveRecord::Migration
       t.column :end_ip_num, :bigint, null: false
       t.column :loc_id, :bigint, null: false
     end
+    add_index :maxmind_geolite_city_blocks, :loc_id
     add_index :maxmind_geolite_city_blocks, :start_ip_num, unique: true
+    add_index :maxmind_geolite_city_blocks, [:end_ip_num, :start_ip_num], unique: true, name: 'index_maxmind_geolite_city_blocks_on_end_ip_num_range'
 
     create_table :maxmind_geolite_city_location, id: false do |t|
       t.column :loc_id, :bigint, null: false
-- 
GitLab