graphql-engine/server/tests-py/queries/graphql_query/boolexp/postgis/setup.yaml
Samir Talwar a0176c215f server/tests-py: Set up postgis extensions using a fixture.
Let's put it in one place.

This is a precursor to moving database provisioning into the Python
integration tests.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5453
GitOrigin-RevId: 5920b0b1177d94496485fcb4e178b946534ee4eb
2022-08-15 14:30:42 +00:00

72 lines
2.3 KiB
YAML

type: bulk
args:
- type: run_sql
args:
sql: |
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