Move ipaddr into common geocoder

This commit is contained in:
Rafa de la Torre
2015-11-03 17:17:13 +01:00
parent 710db23d60
commit 7152048707
8 changed files with 2 additions and 83 deletions

View File

@@ -7,7 +7,8 @@ DATA = $(EXTENSION)--$(EXTVERSION).sql
REGRESS = \
00_install_test \
cdb_geocoder_admin0_test \
cdb_geocoder_admin1_test
cdb_geocoder_admin1_test \
cdb_geocoder_ipaddr_test
# postgres build stuff
PG_CONFIG = pg_config

View File

@@ -1,8 +1,3 @@
CREATE EXTENSION postgis;
CREATE EXTENSION schema_triggers;
CREATE EXTENSION plpythonu;
CREATE EXTENSION cartodb;
CREATE EXTENSION cdb_geocoder_ipaddr;
-- Check that the geocoding function is callable, should return success = false
SELECT (geocode_ip(Array['100.0.24.0'])).*;
q | geom | success
@@ -10,13 +5,6 @@ SELECT (geocode_ip(Array['100.0.24.0'])).*;
100.0.24.0 | | f
(1 row)
-- Mock the varnish invalidation function
CREATE OR REPLACE FUNCTION public.cdb_invalidate_varnish(table_name text) RETURNS void AS $$
BEGIN
RETURN;
END
$$
LANGUAGE plpgsql;
-- Add a few IP sources
COPY ip_address_locations (network_start_ip, the_geom, cartodb_id, created_at, updated_at, the_geom_webmercator) FROM stdin;
-- Check that the geocoding function is callable, should return success = true

View File

@@ -1,6 +1,3 @@
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION cdb_geocoder_ipaddr" to load this file. \quit
-- Response types for IP addresses geocoder
CREATE TYPE geocode_ip_v1 AS (q text, geom geometry, success boolean);

View File

@@ -1,20 +1,6 @@
CREATE EXTENSION postgis;
CREATE EXTENSION schema_triggers;
CREATE EXTENSION plpythonu;
CREATE EXTENSION cartodb;
CREATE EXTENSION cdb_geocoder_ipaddr;
-- Check that the geocoding function is callable, should return success = false
SELECT (geocode_ip(Array['100.0.24.0'])).*;
-- Mock the varnish invalidation function
CREATE OR REPLACE FUNCTION public.cdb_invalidate_varnish(table_name text) RETURNS void AS $$
BEGIN
RETURN;
END
$$
LANGUAGE plpgsql;
-- Add a few IP sources
COPY ip_address_locations (network_start_ip, the_geom, cartodb_id, created_at, updated_at, the_geom_webmercator) FROM stdin;
::ffff:2.235.35.0 0101000020E610000072F90FE9B7CF22405DFE43FAEDC34640 2821226 2014-08-25 10:35:51.665546+00 2014-08-25 10:35:51.665546+00 0101000020110F000010801778FBF32F4109868FF8BCC35541

View File

@@ -1,3 +0,0 @@
results/
regression.diffs
regression.out

View File

@@ -1,8 +0,0 @@
EXTENSION = cdb_geocoder_ipaddr
DATA = cdb_geocoder_ipaddr--0.0.1.sql
REGRESS = cdb_geocoder_ipaddr_test
# postgres build stuff
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

View File

@@ -1,36 +0,0 @@
# CartoDB IP addresses geocoder extension
Postgres extension for the CartoDB IP addresses geocoder. It is meant to contain the functions and related objects needed to geocode by IP addresses. It is not meant to contain the actual data used to geocode them.
## Dependencies
This extension is thought to be used on top of CartoDB platform. Therefore a cartodb user is required to install the extension onto it.
The following is a non-comprehensive list of dependencies:
- Postgres 9.3+
- Postgis extension
- Schema triggers extension
- CartoDB extension
## Installation into the db cluster
This requires root privileges
```
sudo make all install
```
## Execute tests
```
PGUSER=postgres make installcheck
```
## Install onto a user's database
```
psql -U cartodb_dev_user_367c0edc-b2ad-4bab-ad43-3d58a6179a93_db cartodb_dev_user_367c0edc-b2ad-4bab-ad43-3d58a6179a93_db
```
and then:
```sql
CREATE EXTENSION cdb_geocoder_ipaddr;
```
The extension creation in the user's db does not require special privileges. It can be even created from the sql api.

View File

@@ -1,6 +0,0 @@
# cdb geocoder ipaddr extension
comment = 'CartoDB admin0 internal geocoder'
default_version = '0.0.1'
relocatable = true
requires = cartodb
superuser = false