Mercurial > dive4elements > river
changeset 1240:2ef8b67bd68a
Replaced SERIALs with SEQUENCES in PostgreSQL spatial schema.
flys-backend/trunk@2642 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 02 Sep 2011 13:49:46 +0000 |
parents | 07882568cef8 |
children | f68a0504dfb6 |
files | flys-backend/ChangeLog flys-backend/doc/schema/postgresql-spatial.sql flys-backend/src/main/java/de/intevation/flys/model/DGM.java |
diffstat | 3 files changed, 31 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Thu Sep 01 10:03:58 2011 +0000 +++ b/flys-backend/ChangeLog Fri Sep 02 13:49:46 2011 +0000 @@ -1,3 +1,11 @@ +2011-09-02 Ingo Weinzierl <ingo@intevation.de> + + * doc/schema/postgresql-spatial.sql: Removed SERIALs from schema. + Auto-Increment is realized through SERIALs now. + + * src/main/java/de/intevation/flys/model/DGM.java: The table for dem has + been renamed to 'dem' (before 'dgm'). + 2011-09-01 Hans Plum <hans@intevation.de> * doc/schema/postgresql-spatial.sql:
--- a/flys-backend/doc/schema/postgresql-spatial.sql Thu Sep 01 10:03:58 2011 +0000 +++ b/flys-backend/doc/schema/postgresql-spatial.sql Fri Sep 02 13:49:46 2011 +0000 @@ -1,49 +1,58 @@ BEGIN; -- Geodaesie/Flussachse+km/achse +CREATE SEQUENCE RIVER_AXES_ID_SEQ; CREATE TABLE river_axes ( - id SERIAL PRIMARY KEY NOT NULL, + id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), kind int NOT NULL DEFAULT 0 ); SELECT AddGeometryColumn('river_axes', 'geom', 31466, 'LINESTRING', 2); +ALTER TABLE river_axes ALTER COLUMN id SET DEFAULT NEXTVAL('RIVER_AXES_ID_SEQ'); -- Geodaesie/Querprofile/* +CREATE SEQUENCE CROSS_SECTION_TRACKS_ID_SEQ; CREATE TABLE cross_section_tracks ( - id SERIAL PRIMARY KEY NOT NULL, + id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), km NUMERIC NOT NULL, z NUMERIC NOT NULL DEFAULT 0 ); SELECT AddGeometryColumn('cross_section_tracks', 'geom', 31466, 'LINESTRING', 2); +ALTER TABLE cross_section_tracks ALTER COLUMN id SET DEFAULT NEXTVAL('CROSS_SECTION_TRACKS_ID_SEQ'); -- Geodaesie/Linien/rohre-und-spreen +CREATE SEQUENCE LINES_ID_SEQ; CREATE TABLE lines ( - id SERIAL PRIMARY KEY NOT NULL, + id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), kind int NOT NULL DEFAULT 0, z NUMERIC DEFAULT 0 ); SELECT AddGeometryColumn('lines', 'geom', 31466, 'LINESTRING', 4); +ALTER TABLE lines ALTER COLUMN id SET DEFAULT NEXTVAL('LINES_ID_SEQ'); -- 'kind': -- 0: ROHR1 -- 1: DAMM -- Geodaesie/Bauwerke/Wehre.shp +CREATE SEQUENCE BUILDINGS_ID_SEQ; CREATE TABLE buildings ( - id SERIAL PRIMARY KEY NOT NULL, + id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), name VARCHAR(50) ); SELECT AddGeometryColumn('buildings', 'geom', 31466, 'LINESTRING', 2); +ALTER TABLE buildings ALTER COLUMN id SET DEFAULT NEXTVAL('BUILDINGS_ID_SEQ'); -- Geodaesie/Festpunkte/Festpunkte.shp +CREATE SEQUENCE FIXPOINTS_ID_SEQ; CREATE TABLE fixpoints ( - id SERIAL PRIMARY KEY NOT NULL, + id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), x int, y int, @@ -51,20 +60,24 @@ HPGP VARCHAR(2) ); SELECT AddGeometryColumn('fixpoints', 'geom', 31466, 'POINT', 2); +ALTER TABLE fixpoints ALTER COLUMN id SET DEFAULT NEXTVAL('FIXPOINTS_ID_SEQ'); -- Hydrologie/Hydr. Grenzen/talaue.shp +CREATE SEQUENCE FLOODPLAIN_ID_SEQ; CREATE TABLE floodplain ( - id SERIAL PRIMARY KEY NOT NULL, + id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id) ); SELECT AddGeometryColumn('floodplain', 'geom', 31466, 'MULTIPOLYGON', 2); +ALTER TABLE floodplain ALTER COLUMN id SET DEFAULT NEXTVAL('FLOODPLAIN_ID_SEQ'); -- Geodaesie/Hoehenmodelle/* -- XXX DGM in englisch DEM, um dies zu vereinheitlichen -CREATE TABLE dgm ( - id SERIAL PRIMARY KEY NOT NULL, +CREATE SEQUENCE DEM_ID_SEQ; +CREATE TABLE dem ( + id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id), -- XXX Should we use the ranges table instead? lower NUMERIC, @@ -72,6 +85,7 @@ path VARCHAR(256), UNIQUE (river_id, lower, upper) ); +ALTER TABLE dem ALTER COLUMN id SET DEFAULT NEXTVAL('DEM_ID_SEQ'); -- TODO
--- a/flys-backend/src/main/java/de/intevation/flys/model/DGM.java Thu Sep 01 10:03:58 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/DGM.java Fri Sep 02 13:49:46 2011 +0000 @@ -18,7 +18,7 @@ @Entity -@Table(name = "dgm") +@Table(name = "dem") public class DGM implements Serializable { private Integer id;