Mercurial > dive4elements > river
comparison flys-backend/doc/schema/postgresql-spatial.sql @ 5146:d4fdd98a04f7
Add kind_id to river_axes table and add AxisKind object to model
There are currently three kinds: 0 for unkown, 1 for current,
2 for everything else.
Only current is used for calculation
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 28 Feb 2013 18:04:19 +0100 |
parents | 04eb62eae722 |
children | a9658d43b621 |
comparison
equal
deleted
inserted
replaced
5145:801175535406 | 5146:d4fdd98a04f7 |
---|---|
1 BEGIN; | 1 BEGIN; |
2 | |
3 CREATE TABLE axis_kinds( | |
4 id int PRIMARY KEY NOT NULL, | |
5 name VARCHAR(64) | |
6 ); | |
7 INSERT INTO axis_kinds(id, name) VALUES (0, 'Unbekannt'); | |
8 INSERT INTO axis_kinds(id, name) VALUES (1, 'Aktuell'); | |
9 INSERT INTO axis_kinds(id, name) VALUES (2, 'Sonstige'); | |
2 | 10 |
3 -- Geodaesie/Flussachse+km/achse | 11 -- Geodaesie/Flussachse+km/achse |
4 CREATE SEQUENCE RIVER_AXES_ID_SEQ; | 12 CREATE SEQUENCE RIVER_AXES_ID_SEQ; |
5 CREATE TABLE river_axes ( | 13 CREATE TABLE river_axes ( |
6 id int PRIMARY KEY NOT NULL, | 14 id int PRIMARY KEY NOT NULL, |
7 river_id int REFERENCES rivers(id) ON DELETE CASCADE, | 15 river_id int REFERENCES rivers(id) ON DELETE CASCADE, |
8 kind int NOT NULL DEFAULT 0, | 16 kind_id int REFERENCES axis_kinds(id) NOT NULL DEFAULT 0, |
9 name VARCHAR(64), | 17 name VARCHAR(64), |
10 path VARCHAR(256) | 18 path VARCHAR(256) |
11 ); | 19 ); |
12 SELECT AddGeometryColumn('river_axes', 'geom', 31467, 'MULTILINESTRING', 2); | 20 SELECT AddGeometryColumn('river_axes', 'geom', 31467, 'MULTILINESTRING', 2); |
13 ALTER TABLE river_axes ALTER COLUMN id SET DEFAULT NEXTVAL('RIVER_AXES_ID_SEQ'); | 21 ALTER TABLE river_axes ALTER COLUMN id SET DEFAULT NEXTVAL('RIVER_AXES_ID_SEQ'); |