comparison 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
comparison
equal deleted inserted replaced
3175:296392d4539c 3176:1cb6676d1510
295 value int NOT NULL 295 value int NOT NULL
296 ) 296 )
297 297
298 CREATE TABLE gauge_measurements ( 298 CREATE TABLE gauge_measurements (
299 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, 299 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
300 fk_gauge_id isrs NOT NULL REFERENCES gauges, 300 fk_gauge_id isrs NOT NULL CONSTRAINT gauge_key REFERENCES gauges,
301 measure_date timestamp with time zone NOT NULL, 301 measure_date timestamp with time zone NOT NULL,
302 country_code char(2) NOT NULL REFERENCES countries, 302 country_code char(2) NOT NULL REFERENCES countries,
303 -- TODO: add relations to stuff provided as enumerations 303 -- TODO: add relations to stuff provided as enumerations
304 sender varchar NOT NULL, -- "from" attribute from DRC 304 sender varchar NOT NULL, -- "from" attribute from DRC
305 language_code varchar NOT NULL REFERENCES language_codes, 305 language_code varchar NOT NULL REFERENCES language_codes,