Mercurial > dive4elements > river
comparison flys-backend/doc/schema/postgresql.sql @ 2347:0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
flys-backend/trunk@2884 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 04 Oct 2011 15:28:19 +0000 |
parents | f834b411ca57 |
children | fe89d6cf55fb |
comparison
equal
deleted
inserted
replaced
2346:f834b411ca57 | 2347:0acf28a3d28a |
---|---|
1 BEGIN; | 1 BEGIN; |
2 | |
3 CREATE SEQUENCE UNITS_ID_SEQ; | |
4 | |
5 CREATE TABLE units ( | |
6 id int PRIMARY KEY NOT NULL, | |
7 name VARCHAR(32) NOT NULL UNIQUE | |
8 ); | |
2 | 9 |
3 -- Gewaesser | 10 -- Gewaesser |
4 CREATE SEQUENCE RIVERS_ID_SEQ; | 11 CREATE SEQUENCE RIVERS_ID_SEQ; |
5 | 12 |
6 CREATE TABLE rivers ( | 13 CREATE TABLE rivers ( |
7 id int PRIMARY KEY NOT NULL, | 14 id int PRIMARY KEY NOT NULL, |
8 name VARCHAR(256) NOT NULL UNIQUE, | 15 name VARCHAR(256) NOT NULL UNIQUE, |
9 km_up BOOLEAN NOT NULL DEFAULT true | 16 km_up BOOLEAN NOT NULL DEFAULT true, |
17 wst_unit_id int NOT NULL REFERENCES units(id) | |
10 ); | 18 ); |
11 | 19 |
12 -- Bruecke, Haefen, etc. | 20 -- Bruecke, Haefen, etc. |
13 CREATE SEQUENCE ATTRIBUTES_ID_SEQ; | 21 CREATE SEQUENCE ATTRIBUTES_ID_SEQ; |
14 | 22 |
15 CREATE TABLE attributes ( | 23 CREATE TABLE attributes ( |
16 id int PRIMARY KEY NOT NULL, | 24 id int PRIMARY KEY NOT NULL, |
17 value VARCHAR(256) NOT NULL UNIQUE | 25 value VARCHAR(256) NOT NULL UNIQUE |
18 ); | |
19 | |
20 CREATE SEQUENCE UNITS_ID_SEQ; | |
21 | |
22 CREATE TABLE units ( | |
23 id int PRIMARY KEY NOT NULL, | |
24 name VARCHAR(32) NOT NULL UNIQUE | |
25 ); | 26 ); |
26 | 27 |
27 -- segments from/to at a river | 28 -- segments from/to at a river |
28 CREATE SEQUENCE RANGES_ID_SEQ; | 29 CREATE SEQUENCE RANGES_ID_SEQ; |
29 | 30 |
167 CREATE TABLE wsts ( | 168 CREATE TABLE wsts ( |
168 id int PRIMARY KEY NOT NULL, | 169 id int PRIMARY KEY NOT NULL, |
169 river_id int NOT NULL REFERENCES rivers(id), | 170 river_id int NOT NULL REFERENCES rivers(id), |
170 description VARCHAR(256) NOT NULL, | 171 description VARCHAR(256) NOT NULL, |
171 kind int NOT NULL DEFAULT 0, | 172 kind int NOT NULL DEFAULT 0, |
172 unit_id int NOT NULL REFERENCES units(id), | |
173 -- TODO: more meta infos | 173 -- TODO: more meta infos |
174 UNIQUE (river_id, description) | 174 UNIQUE (river_id, description) |
175 ); | 175 ); |
176 | 176 |
177 -- columns of WST files | 177 -- columns of WST files |