graphql-engine/server/tests-py/queries/graphql_query/boolexp/postgis/setup.yaml

83 lines
2.3 KiB
YAML
Raw Normal View History

type: bulk
args:
- type: run_sql
args:
sql: |
CREATE EXTENSION IF NOT EXISTS postgis;
- type: run_sql
args:
sql: |
CREATE EXTENSION IF NOT EXISTS postgis_topology;
#Create table
- type: run_sql
args:
sql: |
CREATE TABLE geom_table(
id SERIAL PRIMARY KEY,
type TEXT NOT NULL,
geom_col geometry NOT NULL
);
- type: track_table
args:
name: geom_table
schema: public
- type: run_sql
args:
sql: |
CREATE TABLE geog_table(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
geog_col geography NOT NULL
);
- type: track_table
args:
name: geog_table
schema: public
- type: run_sql
args:
sql: |
CREATE TABLE geog_as_geom_table(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
geom_col geometry NOT NULL
);
- type: track_table
args:
name: geog_as_geom_table
schema: public
#Insert data
- type: run_sql
args:
sql: |
INSERT INTO geom_table (type, geom_col)
VALUES
('point', ST_GeomFromText('POINT(1 2)')),
('linestring', ST_GeomFromText('LINESTRING(0 0, 0.5 1, 1 2, 1.5 3)')),
('linestring', ST_GeomFromText('LINESTRING(1 0, 0.5 0.5, 0 1)')),
('polygon', ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))')),
('polygon', ST_GeomFromText('POLYGON((2 0, 2 1, 3 1, 3 0, 2 0))'))
;
- type: run_sql
args:
sql: |
INSERT INTO geog_table (name, geog_col)
VALUES
('London', ST_GeographyFromText('POINT(0.1278 51.5074)') ),
('Paris', ST_GeographyFromText('POINT(2.3522 48.8566)') ),
('Moscow', ST_GeographyFromText('POINT(37.6173 55.7558)') ),
('New York', ST_GeographyFromText('POINT(-74.0060 40.7128)') ),
('Linestring', ST_GeographyFromText('SRID=4326;LINESTRING(-43.23456 72.4567,-43.23456 72.4568)')),
('Point', ST_GeographyFromText('SRID=4326;POINT(-43.23456 72.4567772)'));
- type: run_sql
args:
sql: |
INSERT INTO geog_as_geom_table (name, geom_col)
VALUES
('London', ST_GeomFromText('SRID=4326;POINT(0.1278 51.5074)')),
('Paris', ST_GeomFromText('SRID=4326;POINT(2.3522 48.8566)')),
('Moscow', ST_GeomFromText('SRID=4326;POINT(37.6173 55.7558)')),
('New York', ST_GeomFromText('SRID=4326;POINT(-74.0060 40.7128)'));