view flys-backend/doc/schema/postgresql-spatial.sql @ 1236:324cb486db9f

Added relation and hibernate classes for DGMs. flys-backend/trunk@2613 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 31 Aug 2011 07:46:59 +0000
parents e2deda3b77a7
children 774dff3ee546
line wrap: on
line source
BEGIN;

CREATE TABLE river_axes (
    id       SERIAL PRIMARY KEY NOT NULL,
    river_id int REFERENCES rivers(id),
    kind     int             NOT NULL DEFAULT 0
);
SELECT AddGeometryColumn('river_axes', 'geom', 31466, 'LINESTRING', 2);


CREATE TABLE cross_section_tracks (
    id       SERIAL 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);


CREATE TABLE lines (
    id       SERIAL 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);
-- 'kind':
-- 0: ROHR1
-- 1: DAMM


CREATE TABLE buildings (
    id       SERIAL PRIMARY KEY NOT NULL,
    river_id int REFERENCES rivers(id),
    name     VARCHAR(50)
);
SELECT AddGeometryColumn('buildings', 'geom', 31466, 'LINESTRING', 2);


CREATE TABLE fixpoints (
    id       SERIAL PRIMARY KEY NOT NULL,
    river_id int REFERENCES rivers(id),
    x        int,
    y        int,
    km       NUMERIC NOT NULL,
    HPGP     VARCHAR(2)
);
SELECT AddGeometryColumn('fixpoints', 'geom', 31466, 'POINT', 2);


CREATE TABLE dgm (
    id       SERIAL PRIMARY KEY NOT NULL,
    river_id int REFERENCES rivers(id),
    -- XXX Should we use the ranges table instead?
    lower    NUMERIC,
    upper    NUMERIC,
    path     VARCHAR(256),
    UNIQUE (river_id, lower, upper)
);

END;

http://dive4elements.wald.intevation.org