jam-cloud/db/up/fix_max_mind_isp_and_geo.sql

38 lines
1.3 KiB
SQL

-- fix up max_mind_isp
delete from max_mind_isp;
alter table max_mind_isp alter column ip_bottom type bigint using ip_bottom::bigint;
alter table max_mind_isp alter column ip_bottom set not null;
alter table max_mind_isp alter column ip_top type bigint using ip_top::bigint;
alter table max_mind_isp alter column ip_top set not null;
alter table max_mind_isp alter column isp type character varying(64);
alter table max_mind_isp alter column isp set not null;
alter table max_mind_isp alter column country type character varying(2);
alter table max_mind_isp alter column country set not null;
-- fix up max_mind_geo
delete from max_mind_geo;
alter table max_mind_geo alter column ip_start type bigint using 0;
alter table max_mind_geo alter column ip_start set not null;
alter table max_mind_geo alter column ip_end type bigint using 0;
alter table max_mind_geo alter column ip_end set not null;
alter table max_mind_geo alter column country type character varying(2);
alter table max_mind_geo alter column country set not null;
alter table max_mind_geo alter column region type character varying(2);
alter table max_mind_geo alter column region set not null;
alter table max_mind_geo alter column city set not null;
alter table max_mind_geo alter column lat set not null;
alter table max_mind_geo alter column lng set not null;