Mercurial > dive4elements > river
comparison backend/doc/schema/postgresql.sql @ 8683:cfafe5764509
(issue 1796) Scheme change! Add model for seddb_name lookup table.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 13 Apr 2015 11:24:32 +0200 |
parents | 3531f0cee5e1 |
children | 3912da70736b |
comparison
equal
deleted
inserted
replaced
8682:5102733c4567 | 8683:cfafe5764509 |
---|---|
4 | 4 |
5 CREATE TABLE units ( | 5 CREATE TABLE units ( |
6 id int PRIMARY KEY NOT NULL, | 6 id int PRIMARY KEY NOT NULL, |
7 name VARCHAR(32) NOT NULL UNIQUE | 7 name VARCHAR(32) NOT NULL UNIQUE |
8 ); | 8 ); |
9 | |
10 -- SEDDB_NAME | |
11 -- Lookup table for seddb river names | |
12 | |
13 CREATE TABLE seddb_name ( | |
14 id int PRIMARY KEY NOT NULL, | |
15 name VARCHAR(256) NOT NULL | |
16 ); | |
17 INSERT INTO seddb_name (id, name) VALUES (0, 'Rhein'); | |
9 | 18 |
10 -- Gewaesser | 19 -- Gewaesser |
11 CREATE SEQUENCE RIVERS_ID_SEQ; | 20 CREATE SEQUENCE RIVERS_ID_SEQ; |
12 | 21 |
13 CREATE TABLE rivers ( | 22 CREATE TABLE rivers ( |
15 model_uuid CHAR(36) UNIQUE, | 24 model_uuid CHAR(36) UNIQUE, |
16 official_number int8, | 25 official_number int8, |
17 name VARCHAR(256) NOT NULL UNIQUE, | 26 name VARCHAR(256) NOT NULL UNIQUE, |
18 km_up int DEFAULT 0 NOT NULL, | 27 km_up int DEFAULT 0 NOT NULL, |
19 wst_unit_id int NOT NULL REFERENCES units(id), | 28 wst_unit_id int NOT NULL REFERENCES units(id), |
29 seddb_name_id int REFERENCES seddb_name(id), | |
20 CHECK(km_up IN(0,1)) | 30 CHECK(km_up IN(0,1)) |
21 ); | 31 ); |
22 | 32 |
23 -- Bruecke, Haefen, etc. | 33 -- Bruecke, Haefen, etc. |
24 CREATE SEQUENCE ATTRIBUTES_ID_SEQ; | 34 CREATE SEQUENCE ATTRIBUTES_ID_SEQ; |