graphql-engine/server/tests-py/queries/graphql_query/boolexp/postgis/setup.yaml
Philip Carlsen 4cb224afd8 Adding support for ST_3DDWithin and ST_3DIntersects
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: de31fa68fd7dc8ffa0c4e4b89b727a5e14b0525e
2021-04-14 13:03:11 +00:00

80 lines
2.6 KiB
YAML

type: bulk
args:
- type: run_sql
args:
sql: |
CREATE EXTENSION IF NOT EXISTS postgis;
DO $$
BEGIN
IF PostGIS_lib_version() ~ '^3.*' THEN
CREATE EXTENSION IF NOT EXISTS postgis_raster;
END IF;
END$$;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE TABLE geom_table(
id SERIAL PRIMARY KEY,
type TEXT NOT NULL,
geom_col geometry NOT NULL
);
CREATE TABLE geom_3d_table(
id SERIAL PRIMARY KEY,
type TEXT NOT NULL,
geom_col geometry NOT NULL
);
CREATE TABLE geog_table(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
geog_col geography NOT NULL
);
CREATE TABLE geog_as_geom_table(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
geom_col geometry NOT NULL
);
INSERT INTO geom_table (type, geom_col)
VALUES
('point', ST_GeomFromEWKT('SRID=4326;POINT(1 2)')),
('linestring', ST_GeomFromEWKT('SRID=4326;LINESTRING(0 0, 0.5 1, 1 2, 1.5 3)')),
('linestring', ST_GeomFromEWKT('SRID=4326;LINESTRING(1 0, 0.5 0.5, 0 1)')),
('polygon', ST_GeomFromEWKT('SRID=4326;POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))')),
('polygon', ST_GeomFromEWKT('SRID=4326;POLYGON((2 0, 2 1, 3 1, 3 0, 2 0))'))
;
INSERT INTO geom_3d_table (type, geom_col)
VALUES
('raised point', ST_GeomFromEWKT('SRID=0;POINT Z (1 1 10)'))
;
INSERT INTO geog_table (name, geog_col)
VALUES
('London', ST_GeographyFromText('SRID=4326;POINT(0.1278 51.5074)') ),
('Paris', ST_GeographyFromText('SRID=4326;POINT(2.3522 48.8566)') ),
('Moscow', ST_GeographyFromText('SRID=4326;POINT(37.6173 55.7558)') ),
('New York', ST_GeographyFromText('SRID=4326;POINT(-74.0060 40.7128)') ),
('Linestring', ST_GeographyFromText('SRID=4326;LINESTRING(0.0 0.0,0.0 1.0)')),
('Point', ST_GeographyFromText('SRID=4326;POINT(0.0 0.5)'));
INSERT INTO geog_as_geom_table (name, geom_col)
VALUES
('London', ST_GeomFromEWKT('SRID=4326;POINT(0.1278 51.5074)')),
('Paris', ST_GeomFromEWKT('SRID=4326;POINT(2.3522 48.8566)')),
('Moscow', ST_GeomFromEWKT('SRID=4326;POINT(37.6173 55.7558)')),
('New York', ST_GeomFromEWKT('SRID=4326;POINT(-74.0060 40.7128)'));
- type: track_table
args:
name: geom_table
schema: public
- type: track_table
args:
name: geom_3d_table
schema: public
- type: track_table
args:
name: geog_table
schema: public
- type: track_table
args:
name: geog_as_geom_table
schema: public
#Insert data