changeset 5022:e8661379a6c5

Be a bit less stupid in initialising axis validity
author Tom Gottfried <tom@intevation.de>
date Mon, 16 Mar 2020 15:24:08 +0100
parents 6fe3662aafeb
children 776db50c01f0
files schema/updates/1426/01.historicise_axis.sql
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/schema/updates/1426/01.historicise_axis.sql	Mon Mar 16 15:19:13 2020 +0100
+++ b/schema/updates/1426/01.historicise_axis.sql	Mon Mar 16 15:24:08 2020 +0100
@@ -3,9 +3,10 @@
         CHECK (NOT isempty(validity)),
     ADD last_found timestamp with time zone NOT NULL DEFAULT current_timestamp;
 
--- Assume existing entries have been valid since last import
+-- Assume existing entries have been valid since last successful import
 UPDATE waterway.waterway_axis SET validity = tstzrange(
-    (SELECT max(changed) FROM import.imports WHERE kind = 'wx'),
+    (SELECT max(changed) FROM import.imports
+        WHERE kind = 'wx' AND state = CAST('accepted' AS import_state)),
     NULL);
 
 DROP TRIGGER waterway_axis_wtwaxs_unique ON waterway.waterway_axis;