diff schema/gemma.sql @ 3176:1cb6676d1510

Handle failing INSERTs gracefully during gauge measurements import Makes obsolete the code duplicating constraint checking in the application. Although automated constraint naming by PostgreSQL is predictable, name the constraint used for trapping the error explicitly to improve control and traceability.
author Tom Gottfried <tom@intevation.de>
date Mon, 06 May 2019 18:18:17 +0200
parents c8ded555c2a8
children 6f8fb2053881
line wrap: on
line diff
--- a/schema/gemma.sql	Mon May 06 17:45:24 2019 +0200
+++ b/schema/gemma.sql	Mon May 06 18:18:17 2019 +0200
@@ -297,7 +297,7 @@
 
     CREATE TABLE gauge_measurements (
         id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
-        fk_gauge_id isrs NOT NULL REFERENCES gauges,
+        fk_gauge_id isrs NOT NULL CONSTRAINT gauge_key REFERENCES gauges,
         measure_date timestamp with time zone NOT NULL,
         country_code char(2) NOT NULL REFERENCES countries,
         -- TODO: add relations to stuff provided as enumerations