Removed folder-based versioning for extension files

This commit is contained in:
Juan Ignacio Sánchez Lara
2018-02-19 11:27:23 +01:00
parent a5c7f313ac
commit 4326ac3430
23 changed files with 1426 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
-- Install dependencies
CREATE EXTENSION postgis;
CREATE EXTENSION plpythonu;
CREATE EXTENSION cartodb;
-- Mock the quota check
SELECT cartodb.CDB_SetUserQuotaInBytes(0);
-- Install the extension
CREATE EXTENSION cdb_geocoder;
-- Mock the varnish invalidation function
CREATE OR REPLACE FUNCTION public.cdb_invalidate_varnish(table_name text) RETURNS void AS $$
BEGIN
RETURN;
END
$$
LANGUAGE plpgsql;

View File

@@ -0,0 +1,15 @@
-- Check that the synonym function is callable, should return NULL
SELECT (admin0_synonym_lookup(Array['United States', 'ESP'])).*;
-- Check that the geocoding function is callable, should return success = false
SELECT (geocode_admin0_polygons(Array['Spain', 'USA', ''])).*;
-- Add a few synonyms
COPY admin0_synonyms (name, rank, created_at, updated_at, the_geom, the_geom_webmercator, cartodb_id, adm0_a3, name_) FROM stdin;
United States 0 2014-09-30 10:13:28.383426+00 2014-09-30 10:13:28.383426+00 \N \N 29614 USA unitedstates
ESP 3 2014-09-30 10:13:28.383426+00 2014-09-30 10:13:28.383426+00 \N \N 30146 ESP esp
Wallis-et-Futuna 2 2014-09-30 10:13:28.383426+00 2014-09-30 10:13:28.383426+00 \N \N 30013 \N wallisetfutuna
\.
-- Check that the synonym function is callable, should return their iso codes
SELECT (admin0_synonym_lookup(Array['United States', 'ESP'])).*;

View File

@@ -0,0 +1,18 @@
-- Check that the geocoding functions are callable, should return NULL
SELECT (geocode_admin1_polygons(Array['TX','Cuidad Real', 'sevilla'])).*;
SELECT (geocode_admin1_polygons(Array['NH', 'Vermont'], 'United States')).*;
SELECT (geocode_admin1_polygons(Array['az', 'az'], Array['Ecuador', 'USA'])).*;
-- Add a few data to the sources
INSERT INTO global_province_polygons (the_geom, synonyms, iso3) VALUES (
'0106000020E610000001000000010300000001000000040000000000000000E000C01F383D7839B740400000000000E000C0AA3C0EDE220F3B4000000000004812404FB7FCCD04893D400000000000E000C01F383D7839B74040',
Array['vipava','obcina vipava','vipava, obcina'],
'SVN'
);
-- Check that the synonym function is callable, should return true
SELECT (geocode_admin1_polygons(Array['obcina vipava'])).success;
-- Check that it returns the mocked geometry above
SELECT (geocode_admin1_polygons(Array['obcina vipava'])).geom;

View File

@@ -0,0 +1,14 @@
-- Check that the geocoding function is callable, should return success = false
SELECT (geocode_ip(Array['100.0.24.0'])).*;
-- 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
::ffff:31.7.187.0 \N 2783250 2014-08-25 10:35:51.665546+00 2014-08-25 10:35:51.665546+00 \N
::ffff:64.110.146.0 \N 2783251 2014-08-25 10:35:51.665546+00 2014-08-25 10:35:51.665546+00 \N
::ffff:72.5.198.0 \N 2783252 2014-08-25 10:35:51.665546+00 2014-08-25 10:35:51.665546+00 \N
::ffff:77.73.184.0 \N 2783253 2014-08-25 10:35:51.665546+00 2014-08-25 10:35:51.665546+00 \N
\.
-- Check that the geocoding function is callable, should return success = true
SELECT (geocode_ip(Array['2.235.35.0'])).*;

View File

@@ -0,0 +1,22 @@
-- Check that the different geocoding functions are callable, should return success = false
SELECT (geocode_namedplace(Array['Madrid', 'New York City', 'sunapee'])).*;
SELECT (geocode_namedplace(Array['Elche', 'Granada', 'Madrid'], 'Spain')).*;
SELECT (geocode_namedplace(Array['sunapee', 'sunapeeee', 'New York City', 'Madrid'], Array['', 'US', 'United States', NULL])).*;
SELECT (geocode_namedplace(Array['Portland', 'Portland', 'New York City'], Array['Maine', 'Oregon', NULL], 'USA')).*;
SELECT (geocode_namedplace(Array['Portland'], 'Oregon', 'USA')).*;
SELECT (geocode_namedplace(Array['Portland', 'Portland', 'New York City'], Array['Maine', 'Oregon', NULL], Array['USA'])).*;
SELECT namedplace_guess_country(Array['granada', 'jaen', 'cordoba', 'madrid', 'valladolid']);
-- Add a named place source
COPY global_cities_alternates_limited (geoname_id, name, the_geom, created_at, updated_at, the_geom_webmercator, preferred, lowername, cartodb_id, admin1_geonameid, iso2, admin1) FROM stdin;
3128760 barcelona \N 2014-02-11 18:23:18.115612+00 2014-02-25 16:41:15.278786+00 \N t barcelona 7530944 409419 \N 56
\.
COPY global_cities_points_limited (geoname_id, name, asciiname, altnames, featclass, featcode, iso2, admin1, admin2, population, the_geom, created_at, updated_at, the_geom_webmercator, cartodb_id, lowername) FROM stdin;
2421056 Barcelona Barcelona P PPLA ES B 185 0101000020E6100000CA15DEE522E653C0A4C2D842902B4540 2015-06-13 14:48:34.341372+00 2015-06-15 16:53:41.067784+00 0101000020110F00000643969A73E660C10FF27276F0E15341 8653176 barcelona
\.
-- Check that the geocoding function is callable, should return success = true
SELECT (geocode_namedplace(Array['Barcelona'])).*;
SELECT namedplace_guess_country(Array['Barcelona']);

View File

@@ -0,0 +1,54 @@
SELECT (geocode_postalcode_polygons(Array['03204'], Array['Spain'])).*;
SELECT (geocode_postalcode_polygons(Array['03204'], 'ESP')).*;
SELECT (geocode_postalcode_polygons(Array['03204'])).*;
SELECT (geocode_postalcode_points(Array['03204'], 'Spain')).*;
SELECT (geocode_postalcode_points('{03204}', 'Spain')).*;
SELECT (geocode_postalcode_points(Array['03204'])).*;
SELECT (geocode_postalcode_points(Array['03204'], Array['Spain'])).*;
SELECT geocode_greatbritain_outward('YO1 721');
SELECT (admin0_available_services(Array['Spain'])).*;
-- Insert mock source data
INSERT INTO global_postal_code_points (the_geom, iso3, postal_code, postal_code_num) VALUES (
'0101000020E61000000000000000E040408036B47414764840',
'ESP',
'03204',
3204
);
INSERT INTO global_postal_code_polygons (the_geom, iso3, postal_code, postal_code_num) VALUES (
'0106000020E610000001000000010300000001000000040000000000000000E000C01F383D7839B740400000000000E000C0AA3C0EDE220F3B4000000000004812404FB7FCCD04893D400000000000E000C01F383D7839B74040',
'ESP',
'03204',
3204
);
INSERT INTO country_decoder (iso3, synonyms) VALUES (
'ESP',
Array['spain', 'Spain', 'ESP']
);
INSERT INTO available_services (adm0_a3, admin0, postal_code_points, postal_code_polygons) VALUES (
'ESP',
't',
't',
't'
);
INSERT INTO admin0_synonyms (adm0_a3, name, name_, rank) VALUES (
'ESP',
'Spain',
'spain',
3
);
INSERT INTO admin0_synonyms (adm0_a3, name, name_, rank) VALUES (
'ESP',
'ESP',
'esp',
4
);
-- Check that the geocoding function is callable, should return success = true
SELECT (geocode_postalcode_polygons(Array['03204'], Array['Spain'])).geom;