mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-03 00:02:25 -05:00
Adds a "qgis_test_user" database users with the db setup script, using an hard-coded password for connection. This was the simplest way to make things work because the alternative of using 'options' member in the URI is not supported by QGIS at the moment, see https://github.com/qgis/QGIS/issues/32832
39 lines
1.1 KiB
SQL
39 lines
1.1 KiB
SQL
DO $$
|
|
DECLARE
|
|
layerid INTEGER;
|
|
|
|
BEGIN
|
|
IF EXISTS ( SELECT * FROM pg_catalog.pg_available_extensions
|
|
WHERE name = 'postgis_topology' )
|
|
THEN
|
|
RAISE NOTICE 'Loading postgis_topology';
|
|
CREATE EXTENSION IF NOT EXISTS postgis_topology;
|
|
|
|
-- Topology: qgis_test_Topo1
|
|
|
|
IF EXISTS ( SELECT * FROM pg_catalog.pg_namespace WHERE
|
|
nspname = 'qgis_test_Topo1' )
|
|
THEN
|
|
PERFORM topology.DropTopology('qgis_test_Topo1');
|
|
END IF;
|
|
|
|
PERFORM topology.CreateTopology('qgis_test_Topo1');
|
|
|
|
-- TopoLayer: qgis_test.TopoLayer1
|
|
|
|
DROP TABLE IF EXISTS qgis_test."TopoLayer1";
|
|
CREATE TABLE qgis_test."TopoLayer1" (id serial primary key);
|
|
layerid := topology.AddTopoGeometryColumn('qgis_test_Topo1',
|
|
'qgis_test',
|
|
'TopoLayer1',
|
|
'topogeom',
|
|
'POLYGON');
|
|
INSERT INTO qgis_test."TopoLayer1" (topogeom) SELECT
|
|
topology.toTopoGeom('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))',
|
|
'qgis_test_Topo1', layerid);
|
|
|
|
END IF;
|
|
END;
|
|
$$;
|
|
|