From 914502bcc97400197c7fe9b1a3b428d40f017312 Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Wed, 26 Feb 2014 14:20:15 -0500
Subject: [PATCH] Rename tables.

Need increased specificity to support other MaxMind packages.
---
 .../geocoder/templates/migration/maxmind_geolite_city.rb  | 8 ++++----
 lib/geocoder/lookups/maxmind_local.rb                     | 2 +-
 lib/maxmind_database.rb                                   | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/generators/geocoder/templates/migration/maxmind_geolite_city.rb b/lib/generators/geocoder/templates/migration/maxmind_geolite_city.rb
index 5c7b863e..3904d9d7 100644
--- a/lib/generators/geocoder/templates/migration/maxmind_geolite_city.rb
+++ b/lib/generators/geocoder/templates/migration/maxmind_geolite_city.rb
@@ -1,13 +1,13 @@
 class GeocoderMaxmindGeoliteCity < ActiveRecord::Migration
   def change
-    create_table :maxmind_blocks, id: false do |t|
+    create_table :maxmind_geolite_city_blocks, id: false do |t|
       t.column :startIpNum, 'integer unsigned', null: false
       t.column :endIpNum, 'integer unsigned', null: false
       t.column :locId, 'integer unsigned', null: false
     end
-    add_index :maxmind_blocks, :startIpNum, unique: true
+    add_index :maxmind_geolite_city_blocks, :startIpNum, unique: true
 
-    create_table :maxmind_location, id: false do |t|
+    create_table :maxmind_geolite_city_location, id: false do |t|
   	  t.column :locId, 'integer unsigned', null: false
       t.string :country, null: false
       t.string :region, null: false
@@ -18,6 +18,6 @@ class GeocoderMaxmindGeoliteCity < ActiveRecord::Migration
       t.integer :metroCode
       t.integer :areaCode
     end
-    add_index :maxmind_location, :locId, unique: true
+    add_index :maxmind_geolite_city_location, :locId, unique: true
   end
 end
diff --git a/lib/geocoder/lookups/maxmind_local.rb b/lib/geocoder/lookups/maxmind_local.rb
index 3d58546d..7ba53b05 100644
--- a/lib/geocoder/lookups/maxmind_local.rb
+++ b/lib/geocoder/lookups/maxmind_local.rb
@@ -35,7 +35,7 @@ module Geocoder::Lookup
       else
         addr = IPAddr.new(query.text).to_i
         q = "SELECT l.country, l.region, l.city
-          FROM maxmind_location l JOIN maxmind_blocks b USING (locId)
+          FROM maxmind_geolite_city_location l JOIN maxmind_geolite_city_blocks b USING (locId)
           WHERE b.startIpNum <= #{addr} AND #{addr} <= b.endIpNum"
         if r = ActiveRecord::Base.connection.execute(q).first
           [Hash[*[:country_name, :region_name, :city_name].zip(r).flatten]]
diff --git a/lib/maxmind_database.rb b/lib/maxmind_database.rb
index 53a4a533..efcbe56e 100644
--- a/lib/maxmind_database.rb
+++ b/lib/maxmind_database.rb
@@ -47,7 +47,7 @@ module Geocoder
           end
         end
         insert_into_table(table, headers, rows) if rows.size > 0
-        puts "finished (#{Time.now - start_time} seconds)"
+        puts "done (#{Time.now - start_time} seconds)"
       end
     end
 
@@ -78,7 +78,7 @@ module Geocoder
       when :geolite_city_csv
         # use the last two in case multiple versions exist
         files = Dir.glob(File.join(dir, "GeoLiteCity_*/*.csv"))[-2..-1]
-        Hash[*files.zip(["maxmind_blocks", "maxmind_location"]).flatten]
+        Hash[*files.zip(["maxmind_geolite_city_blocks", "maxmind_geolite_city_location"]).flatten]
       end
     end
 
-- 
GitLab