diff schema/tap_tests_data.sql @ 4389:5e38667f740c stretches-for-responsibility

Use stretches as areas of responsibility. This is heavily based on a patch by Tom Gottfried (read: >90% of the work was done by Tom).
author Sascha Wilde <wilde@intevation.de>
date Thu, 12 Sep 2019 18:13:47 +0200
parents 52f7264265bb
children b0c974fc7d34
line wrap: on
line diff
--- a/schema/tap_tests_data.sql	Wed Sep 11 10:32:19 2019 +0200
+++ b/schema/tap_tests_data.sql	Thu Sep 12 18:13:47 2019 +0200
@@ -4,7 +4,7 @@
 -- SPDX-License-Identifier: AGPL-3.0-or-later
 -- License-Filename: LICENSES/AGPL-3.0.txt
 
--- Copyright (C) 2018 by via donau
+-- Copyright (C) 2018, 2019 by via donau
 --   – Österreichische Wasserstraßen-Gesellschaft mbH
 -- Software engineering by Intevation GmbH
 
@@ -20,9 +20,35 @@
 INSERT INTO language_codes VALUES ('DE');
 INSERT INTO depth_references VALUES ('ZPG');
 
-INSERT INTO users.responsibility_areas VALUES
-    ('AT', ST_geomfromtext('MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 4326)),
-    ('RO', ST_geomfromtext('MULTIPOLYGON(((1 0, 1 1, 2 1, 2 0, 1 0)))', 4326));
+WITH insert_st AS (
+    INSERT INTO users.stretches (
+        name, stretch, area, objnam, source_organization, staging_done
+    ) VALUES (
+        'AT',
+        isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs,
+            ('AT', 'XXX', '00001', '00000', 1)::isrs),
+        ST_geomfromtext('MULTIPOLYGON(((-1 0, -1 1, 0 1, 0 0, -1 0)))', 4326),
+        'AT',
+        'AT',
+        true
+    ), (
+        'AT_RO',
+        isrsrange(('AT', 'XXX', '00001', '00000', 1)::isrs,
+            ('AT', 'XXX', '00001', '00000', 2)::isrs),
+        ST_geomfromtext('MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 4326),
+        'AT',
+        'AT',
+        true
+    ), (
+        'RO',
+        isrsrange(('RO', 'XXX', '00001', '00000', 0)::isrs,
+            ('RO', 'XXX', '00001', '00000', 1)::isrs),
+        ST_geomfromtext('MULTIPOLYGON(((1 0, 1 1, 2 1, 2 0, 1 0)))', 4326),
+        'RO',
+        'RO',
+        true
+    ) RETURNING id, objnam)
+INSERT INTO users.stretch_countries SELECT id, objnam FROM insert_st;
 
 INSERT INTO users.list_users VALUES (
     'waterway_user', 'test_user_at', 'user_at1$', 'AT', NULL, 'xxx');