comparison flys-backend/doc/schema/postgresql-spatial.sql @ 4953:a72e90fc45ed dami

SCHEMA CHANGE: extended hydr_boundaries tables
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 01 Feb 2013 10:41:12 +0100
parents f5c55d7ea07e
children b79eb203032d
comparison
equal deleted inserted replaced
4952:5a0225ddae2b 4953:a72e90fc45ed
239 SELECT AddGeometryColumn('floodmaps', 'geom', 31467, 'MULTIPOLYGON', 2); 239 SELECT AddGeometryColumn('floodmaps', 'geom', 31467, 'MULTIPOLYGON', 2);
240 ALTER TABLE floodmaps DROP CONSTRAINT enforce_geotype_geom; 240 ALTER TABLE floodmaps DROP CONSTRAINT enforce_geotype_geom;
241 ALTER TABLE floodmaps ADD CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POLYGON'::text OR geometrytype(geom) = 'MULTIPOLYGON'::text); 241 ALTER TABLE floodmaps ADD CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POLYGON'::text OR geometrytype(geom) = 'MULTIPOLYGON'::text);
242 ALTER TABLE floodmaps ALTER COLUMN id SET DEFAULT NEXTVAL('FLOODMAPS_ID_SEQ'); 242 ALTER TABLE floodmaps ALTER COLUMN id SET DEFAULT NEXTVAL('FLOODMAPS_ID_SEQ');
243 243
244
245 CREATE SEQUENCE HYDR_BOUNDARIES_ID_SEQ; 244 CREATE SEQUENCE HYDR_BOUNDARIES_ID_SEQ;
246 CREATE TABLE hydr_boundaries ( 245 CREATE TABLE hydr_boundaries (
247 id int PRIMARY KEY NOT NULL, 246 id int PRIMARY KEY NOT NULL,
248 river_id int REFERENCES rivers(id), 247 river_id int REFERENCES rivers(id),
249 name VARCHAR(255), 248 name VARCHAR(255),
250 kind int, 249 kind int, -- 1 BfG / 2 Land / 3 Sonstige
250 sectie int, -- 1 stromführend / 2 stromspeichernd
251 sobek int, -- 1 Flussschlauch / 2 Uferbank / 3 Überflutungsbereich
251 path VARCHAR(256) 252 path VARCHAR(256)
252 ); 253 );
253 SELECT AddGeometryColumn('hydr_boundaries','geom',31467,'LINESTRING',3); 254 SELECT AddGeometryColumn('hydr_boundaries','geom',31467,'LINESTRING',3);
254 ALTER TABLE hydr_boundaries ALTER COLUMN id SET DEFAULT NEXTVAL('HYDR_BOUNDARIES_ID_SEQ'); 255 ALTER TABLE hydr_boundaries ALTER COLUMN id SET DEFAULT NEXTVAL('HYDR_BOUNDARIES_ID_SEQ');
255 256
257 CREATE SEQUENCE HYDR_BOUNDARIES_POLY_ID_SEQ; 258 CREATE SEQUENCE HYDR_BOUNDARIES_POLY_ID_SEQ;
258 CREATE TABLE hydr_boundaries_poly ( 259 CREATE TABLE hydr_boundaries_poly (
259 id int PRIMARY KEY NOT NULL, 260 id int PRIMARY KEY NOT NULL,
260 river_id int REFERENCES rivers(id), 261 river_id int REFERENCES rivers(id),
261 name VARCHAR(255), 262 name VARCHAR(255),
262 kind int, 263 kind int, -- 1 BfG / 2 Land / 3 Sonstige
264 sectie int, -- 1 Flussschlauch / 2 Uferbank / 3 Überflutungsbereich
265 sobek int, -- 1 stromführend / 2 stromspeichernd
263 path VARCHAR(256) 266 path VARCHAR(256)
264 ); 267 );
265 SELECT AddGeometryColumn('hydr_boundaries_poly','geom',31467,'POLYGON',3); 268 SELECT AddGeometryColumn('hydr_boundaries_poly','geom',31467,'POLYGON',3);
266 ALTER TABLE hydr_boundaries_poly ALTER COLUMN id SET DEFAULT NEXTVAL('HYDR_BOUNDARIES_POLY_ID_SEQ'); 269 ALTER TABLE hydr_boundaries_poly ALTER COLUMN id SET DEFAULT NEXTVAL('HYDR_BOUNDARIES_POLY_ID_SEQ');
267 270

http://dive4elements.wald.intevation.org