comparison schema/auth_tests.sql @ 3302:ec6163c6687d

'Historicise' gauges on import Gauge data sets will be updated or a new version will be inserted depending on temporal validity and a timestamp marking the last update in the RIS-Index of a data set. The trigger on date_info is removed because the value is actually an attribut coming from the RIS-Index. Gauge measurements and predictions are associated to the version with matching temporal validity. Bottlenecks are always associated to the actual version of the gauge, although this might change as soon as bottlenecks are 'historicised', too.
author Tom Gottfried <tom@intevation.de>
date Thu, 16 May 2019 18:41:43 +0200
parents 5470aa3ffb9a
children 02951a62e8c6
comparison
equal deleted inserted replaced
3301:6514b943654e 3302:ec6163c6687d
73 -- 73 --
74 SET SESSION AUTHORIZATION test_admin_at; 74 SET SESSION AUTHORIZATION test_admin_at;
75 75
76 PREPARE bn_insert (varchar, geometry(MULTIPOLYGON, 4326)) AS 76 PREPARE bn_insert (varchar, geometry(MULTIPOLYGON, 4326)) AS
77 INSERT INTO waterway.bottlenecks ( 77 INSERT INTO waterway.bottlenecks (
78 bottleneck_id, fk_g_fid, stretch, area, rb, lb, responsible_country, 78 gauge_location, gauge_validity,
79 bottleneck_id, stretch, area, rb, lb, responsible_country,
79 revisiting_time, limiting, source_organization) 80 revisiting_time, limiting, source_organization)
80 VALUES ( 81 SELECT
82 location, validity,
81 $1, 83 $1,
82 ('AT', 'XXX', '00001', 'G0001', 1)::isrs,
83 isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs, 84 isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs,
84 ('AT', 'XXX', '00001', '00000', 2)::isrs), 85 ('AT', 'XXX', '00001', '00000', 2)::isrs),
85 $2, 'AT', 'AT', 'AT', 86 $2, 'AT', 'AT', 'AT',
86 1, 'depth', 'testorganization' 87 1, 'depth', 'testorganization'
87 ); 88 FROM waterway.gauges
89 WHERE location = ('AT', 'XXX', '00001', 'G0001', 1)::isrs;
88 SELECT lives_ok($$ 90 SELECT lives_ok($$
89 EXECUTE bn_insert( 91 EXECUTE bn_insert(
90 'test1', 92 'test1',
91 ST_geomfromtext('MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 4326)) 93 ST_geomfromtext('MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 4326))
92 $$, 94 $$,