Mercurial > gemma
diff 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 |
line wrap: on
line diff
--- a/schema/auth_tests.sql Thu May 16 17:22:33 2019 +0200 +++ b/schema/auth_tests.sql Thu May 16 18:41:43 2019 +0200 @@ -75,16 +75,18 @@ PREPARE bn_insert (varchar, geometry(MULTIPOLYGON, 4326)) AS INSERT INTO waterway.bottlenecks ( - bottleneck_id, fk_g_fid, stretch, area, rb, lb, responsible_country, + gauge_location, gauge_validity, + bottleneck_id, stretch, area, rb, lb, responsible_country, revisiting_time, limiting, source_organization) - VALUES ( + SELECT + location, validity, $1, - ('AT', 'XXX', '00001', 'G0001', 1)::isrs, isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs, ('AT', 'XXX', '00001', '00000', 2)::isrs), $2, 'AT', 'AT', 'AT', 1, 'depth', 'testorganization' - ); + FROM waterway.gauges + WHERE location = ('AT', 'XXX', '00001', 'G0001', 1)::isrs; SELECT lives_ok($$ EXECUTE bn_insert( 'test1',