comparison schema/gemma.sql @ 4717:9279fdb7a422

Ensure unique names of sections and stretches
author Tom Gottfried <tom@intevation.de>
date Thu, 17 Oct 2019 12:55:13 +0200
parents 443867b548b5
children 92640ae5be07
comparison
equal deleted inserted replaced
4716:310f5a5e2ea2 4717:9279fdb7a422
405 405
406 -- Namespace for user management related data 406 -- Namespace for user management related data
407 CREATE SCHEMA users 407 CREATE SCHEMA users
408 CREATE TABLE stretches ( 408 CREATE TABLE stretches (
409 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, 409 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
410 name varchar NOT NULL, 410 name varchar UNIQUE NOT NULL,
411 stretch isrsrange NOT NULL, 411 stretch isrsrange NOT NULL,
412 area geography(MULTIPOLYGON, 4326) NOT NULL 412 area geography(MULTIPOLYGON, 4326) NOT NULL
413 CHECK(ST_IsValid(CAST(area AS geometry))), 413 CHECK(ST_IsValid(CAST(area AS geometry))),
414 objnam varchar NOT NULL, 414 objnam varchar NOT NULL,
415 nobjnam varchar, 415 nobjnam varchar,
580 ) 580 )
581 581
582 -- Like stretches without the countries 582 -- Like stretches without the countries
583 CREATE TABLE sections ( 583 CREATE TABLE sections (
584 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, 584 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
585 name varchar NOT NULL, 585 name varchar UNIQUE NOT NULL,
586 section isrsrange NOT NULL, 586 section isrsrange NOT NULL,
587 area geography(MULTIPOLYGON, 4326) NOT NULL 587 area geography(MULTIPOLYGON, 4326) NOT NULL
588 CHECK(ST_IsValid(CAST(area AS geometry))), 588 CHECK(ST_IsValid(CAST(area AS geometry))),
589 objnam varchar NOT NULL, 589 objnam varchar NOT NULL,
590 nobjnam varchar, 590 nobjnam varchar,