Mercurial > dive4elements > river
comparison flys-backend/contrib/hws_schema.diff @ 4883:186dd186d5bd
Importer: Add new HWS schema as a patch for now.
This might be subject to further change so its only a patch for now
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 25 Jan 2013 15:43:05 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4882:e9880b224c2f | 4883:186dd186d5bd |
---|---|
1 diff -r 0bb0525bca52 flys-backend/doc/schema/postgresql-drop-spatial.sql | |
2 --- a/flys-backend/doc/schema/postgresql-drop-spatial.sql Fri Jan 25 15:38:34 2013 +0100 | |
3 +++ b/flys-backend/doc/schema/postgresql-drop-spatial.sql Fri Jan 25 15:42:05 2013 +0100 | |
4 @@ -27,8 +27,14 @@ | |
5 DROP TABLE catchment; | |
6 DROP SEQUENCE CATCHMENT_ID_SEQ; | |
7 | |
8 -DROP TABLE hws; | |
9 -DROP SEQUENCE HWS_ID_SEQ; | |
10 +--DROP TABLE hws; | |
11 +--DROP SEQUENCE HWS_ID_SEQ; | |
12 + | |
13 +DROP TABLE hws_points; | |
14 +DROP SEQUENCE HWS_POINTS_ID_SEQ; | |
15 + | |
16 +DROP TABLE hws_lines; | |
17 +DROP SEQUENCE HWS_LINES_ID_SEQ; | |
18 | |
19 DROP TABLE floodmaps; | |
20 DROP SEQUENCE FLOODMAPS_ID_SEQ; | |
21 @@ -42,4 +48,7 @@ | |
22 DROP TABLE gauge_location; | |
23 DROP SEQUENCE GAUGE_LOCATION_ID_SEQ; | |
24 | |
25 +DROP TABLE fed_states; | |
26 +DROP TABLE hws_kinds; | |
27 + | |
28 COMMIT; | |
29 diff -r 0bb0525bca52 flys-backend/doc/schema/postgresql-spatial.sql | |
30 --- a/flys-backend/doc/schema/postgresql-spatial.sql Fri Jan 25 15:38:34 2013 +0100 | |
31 +++ b/flys-backend/doc/schema/postgresql-spatial.sql Fri Jan 25 15:42:05 2013 +0100 | |
32 @@ -132,20 +132,87 @@ | |
33 SELECT AddGeometryColumn('catchment','geom',31467,'POLYGON',2); | |
34 ALTER TABLE catchment ALTER COLUMN id SET DEFAULT NEXTVAL('CATCHMENT_ID_SEQ'); | |
35 | |
36 +-- Static lookup tables for Hochwasserschutzanlagen | |
37 +CREATE TABLE hws_kinds ( | |
38 + id int PRIMARY KEY NOT NULL, | |
39 + kind VARCHAR(64) NOT NULL | |
40 +); | |
41 +INSERT INTO hws_kinds (id, kind) VALUES (1, 'Durchlass'); | |
42 +INSERT INTO hws_kinds (id, kind) VALUES (2, 'Damm'); | |
43 +INSERT INTO hws_kinds (id, kind) VALUES (3, 'Graben'); | |
44 | |
45 ---Hydrologie/HW-Schutzanlagen/hws.shp | |
46 -CREATE SEQUENCE HWS_ID_SEQ; | |
47 -CREATE TABLE hws ( | |
48 +CREATE TABLE fed_states ( | |
49 id int PRIMARY KEY NOT NULL, | |
50 + name VARCHAR(23) NOT NULL | |
51 +); | |
52 +INSERT INTO fed_states (id, name) VALUES (1, 'Bayern'); | |
53 +INSERT INTO fed_states (id, name) VALUES (2, 'Hessen'); | |
54 +INSERT INTO fed_states (id, name) VALUES (3, 'Niedersachsen'); | |
55 +INSERT INTO fed_states (id, name) VALUES (4, 'Nordrhein-Westfalen'); | |
56 +INSERT INTO fed_states (id, name) VALUES (5, 'Rheinland-Pfalz'); | |
57 +INSERT INTO fed_states (id, name) VALUES (6, 'Saarland'); | |
58 +INSERT INTO fed_states (id, name) VALUES (7, 'Schleswig-Holstein'); | |
59 +INSERT INTO fed_states (id, name) VALUES (8, 'Brandenburg'); | |
60 +INSERT INTO fed_states (id, name) VALUES (9, 'Mecklenburg-Vorpommern'); | |
61 +INSERT INTO fed_states (id, name) VALUES (10, 'Thüringen'); | |
62 +INSERT INTO fed_states (id, name) VALUES (11, 'Baden-Württemberg'); | |
63 +INSERT INTO fed_states (id, name) VALUES (12, 'Sachsen-Anhalt'); | |
64 +INSERT INTO fed_states (id, name) VALUES (13, 'Sachsen'); | |
65 +INSERT INTO fed_states (id, name) VALUES (14, 'Berlin'); | |
66 +INSERT INTO fed_states (id, name) VALUES (15, 'Bremen'); | |
67 +INSERT INTO fed_states (id, name) VALUES (16, 'Hamburg'); | |
68 + | |
69 +--Hydrologie/HW-Schutzanlagen/*Linien.shp | |
70 +CREATE SEQUENCE HWS_LINES_ID_SEQ; | |
71 +CREATE TABLE hws_lines ( | |
72 + id int PRIMARY KEY NOT NULL, | |
73 + ogr_fid int, | |
74 + kind_id int REFERENCES hws_kinds(id) DEFAULT 2, | |
75 + fed_state_id int REFERENCES fed_states(id), | |
76 river_id int REFERENCES rivers(id), | |
77 - hws_facility VARCHAR(256), | |
78 - type VARCHAR(256), | |
79 - name VARCHAR(64), | |
80 - path VARCHAR(256) | |
81 + name VARCHAR(256), | |
82 + path VARCHAR(256), | |
83 + offical INT DEFAULT 0, | |
84 + agency VARCHAR(256), | |
85 + range VARCHAR(256), | |
86 + shore_side INT DEFAULT 0, | |
87 + source VARCHAR(256), | |
88 + status_date TIMESTAMP, | |
89 + description VARCHAR(256) | |
90 ); | |
91 -SELECT AddGeometryColumn('hws','geom',31467,'LINESTRING',2); | |
92 -ALTER TABLE hws ALTER COLUMN id SET DEFAULT NEXTVAL('HWS_ID_SEQ'); | |
93 +SELECT AddGeometryColumn('hws_lines', 'geom', 31467, 'LINESTRING', 2); | |
94 +SELECT AddGeometryColumn('hws_lines', 'geom_target', 31467, 'LINESTRING', 2); -- ? | |
95 +SELECT AddGeometryColumn('hws_lines', 'geom_rated_level', 31467, 'LINESTRING', 2); -- ? | |
96 +-- TODO: dike_km_from dike_km_to, are they geometries? | |
97 | |
98 +ALTER TABLE hws_lines ALTER COLUMN id SET DEFAULT NEXTVAL('HWS_LINES_ID_SEQ'); | |
99 + | |
100 +--Hydrologie/HW-Schutzanlagen/*Punkte.shp | |
101 +CREATE SEQUENCE HWS_POINTS_ID_SEQ; | |
102 +CREATE TABLE hws_points ( | |
103 + id int PRIMARY KEY NOT NULL, | |
104 + ogr_fid int, | |
105 + kind_id int REFERENCES hws_kinds(id) DEFAULT 2, | |
106 + fed_state_id int REFERENCES fed_states(id), | |
107 + river_id int REFERENCES rivers(id), | |
108 + name VARCHAR, | |
109 + path VARCHAR, | |
110 + offical INT DEFAULT 0, | |
111 + agency VARCHAR, | |
112 + range VARCHAR, | |
113 + shore_side INT DEFAULT 0, | |
114 + source VARCHAR, | |
115 + status_date VARCHAR, | |
116 + description VARCHAR, | |
117 + freeboard FLOAT8, | |
118 + dike_km FLOAT8, | |
119 + z FLOAT8, | |
120 + z_target FLOAT8, | |
121 + rated_level FLOAT8 | |
122 +); | |
123 +SELECT AddGeometryColumn('hws_points', 'geom', 31467, 'POINT', 2); | |
124 + | |
125 +ALTER TABLE hws_points ALTER COLUMN id SET DEFAULT NEXTVAL('HWS_POINTS_ID_SEQ'); | |
126 | |
127 -- | |
128 --Hydrologie/UeSG |