Mercurial > gemma
comparison schema/gemma.sql @ 3171:c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 06 May 2019 16:36:03 +0200 |
parents | f394e828a6d2 |
children | 1cb6676d1510 |
comparison
equal
deleted
inserted
replaced
3170:5c8ecab9f2d4 | 3171:c8ded555c2a8 |
---|---|
404 ON DELETE CASCADE, | 404 ON DELETE CASCADE, |
405 country_code char(2) NOT NULL REFERENCES countries(country_code), | 405 country_code char(2) NOT NULL REFERENCES countries(country_code), |
406 UNIQUE(stretches_id, country_code) | 406 UNIQUE(stretches_id, country_code) |
407 ) | 407 ) |
408 | 408 |
409 -- Like stretches without the countries | |
410 CREATE TABLE sections ( | |
411 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | |
412 name varchar NOT NULL, | |
413 stretch isrsrange NOT NULL, | |
414 area geography(MULTIPOLYGON, 4326) NOT NULL | |
415 CHECK(ST_IsValid(CAST(area AS geometry))), | |
416 objnam varchar NOT NULL, | |
417 nobjnam varchar, | |
418 date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
419 source_organization varchar NOT NULL, | |
420 staging_done boolean NOT NULL DEFAULT false, | |
421 UNIQUE(name, staging_done) | |
422 ) | |
423 CREATE TRIGGER sections_date_info | |
424 BEFORE UPDATE ON stretches | |
425 FOR EACH ROW EXECUTE PROCEDURE update_date_info() | |
426 | |
409 CREATE TABLE waterway_profiles ( | 427 CREATE TABLE waterway_profiles ( |
410 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | 428 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, |
411 location isrs NOT NULL REFERENCES distance_marks_virtual, | 429 location isrs NOT NULL REFERENCES distance_marks_virtual, |
412 geom geography(linestring, 4326), | 430 geom geography(linestring, 4326), |
413 validity tstzrange, | 431 validity tstzrange, |