fix case where connection_client_type.sql is boggled by existing connections, and added schema for cities, regions, and countries.

This commit is contained in:
Scott Comer 2014-03-07 17:23:04 -06:00
parent 5a51bae5fd
commit d7443edf58
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,8 @@
create table cities (city varchar(255) not null, region varchar(2) not null, regionname varchar(64), countrycode varchar(2) not null, countryname varchar(64));
insert into cities (city, region, countrycode) select distinct city, region, countrycode from geoiplocations where length(city) > 0 and length(countrycode) > 0;
create table regions (region varchar(2) not null, regionname varchar(64), countrycode varchar(2) not null);
insert into regions (region, countrycode) select distinct region, countrycode from cities;
create table countries (countrycode varchar(2) not null, countryname varchar(64));
insert into countries (countrycode) select distinct countrycode from regions;

View File

@ -1 +1,3 @@
ALTER TABLE connections ADD COLUMN client_type VARCHAR(256) NOT NULL;
ALTER TABLE connections ADD COLUMN client_type VARCHAR(256);
UPDATE connections SET client_type = 'old' WHERE client_type IS NULL;
ALTER TABLE connections ALTER COLUMN client_type SET NOT NULL;