Mercurial > dive4elements > river
diff flys-backend/doc/schema/postgresql-spatial.sql @ 5291:66d9389c80cb
added tables for jetties in spatial schema
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 14 Mar 2013 12:16:58 +0100 |
parents | 170f514a4f29 |
children | 3dc4c2798212 |
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql-spatial.sql Thu Mar 14 11:56:13 2013 +0100 +++ b/flys-backend/doc/schema/postgresql-spatial.sql Thu Mar 14 12:16:58 2013 +0100 @@ -112,8 +112,8 @@ river_id int REFERENCES rivers(id) ON DELETE CASCADE, -- XXX Should we use the ranges table instead? name VARCHAR(64), - range_id INT REFERENCES ranges(id); - time_interval_id INT REFERENCES time_intervals(id); + range_id INT REFERENCES ranges(id), + time_interval_id INT REFERENCES time_intervals(id), projection VARCHAR(32), srid int NOT NULL, elevation_state VARCHAR(32), @@ -300,4 +300,26 @@ SELECT AddGeometryColumn('gauge_location','geom',31467,'POINT',2); ALTER TABLE gauge_location ALTER COLUMN id SET DEFAULT NEXTVAL('GAUGE_LOCATION_ID_SEQ'); + +CREATE TABLE jetty_kinds( + id int PRIMARY KEY NOT NULL, + name VARCHAR(64) +); +INSERT INTO jetty_kinds VALUES (0, 'Buhnenkopf'); +INSERT INTO jetty_kinds VALUES (1, 'Buhnenfuß'); +INSERT INTO jetty_kinds VALUES (2, 'Buhnenwurzel'); + +CREATE SEQUENCE JETTIES_ID_SEQ; +CREATE TABLE jetties ( + id int PRIMARY KEY NOT NULL, + river_id int REFERENCES rivers(id) ON DELETE CASCADE, + path VARCHAR(256), + kind_id int REFERENCES jetty_kinds(id), + km FLOAT8, + z FLOAT8 +); +SELECT AddGeometryColumn('jetties','geom',31467,'POINT',2); +ALTER TABLE jetties ALTER COLUMN id SET DEFAULT NEXTVAL('JETTIES_ID_SEQ'); + + COMMIT;