ALTER TABLE `devices` CHANGE `location` `location` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL;
CREATE TABLE IF NOT EXISTS `devices_locations` ( `location_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT , `device_id` INT(11) UNSIGNED NOT NULL , `location` TEXT NOT NULL , `location_lat` FLOAT NULL DEFAULT NULL , `location_lon` FLOAT NULL DEFAULT NULL , `location_country` VARCHAR(32) NOT NULL , `location_state` VARCHAR(32) NOT NULL , `location_county` VARCHAR(32) NOT NULL , `location_city` VARCHAR(32) NOT NULL , `location_geoapi` VARCHAR(16) NOT NULL , `location_status` TEXT NULL , `location_manual` BOOLEAN NOT NULL DEFAULT FALSE , `location_updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`location_id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Stores geo location information';