comparison backend/doc/schema/postgresql.sql @ 5894:62e6598a2c4b

Schema change: make gauges.official_number unique per river as we can have multiple identical gauges for different representations of the same river. Comments and TODOs
author Tom Gottfried <tom@intevation.de>
date Fri, 03 May 2013 10:31:34 +0200
parents c1abd48a03e2
children 4fafe8d147b2
comparison
equal deleted inserted replaced
5893:c1abd48a03e2 5894:62e6598a2c4b
84 name VARCHAR(256) NOT NULL, 84 name VARCHAR(256) NOT NULL,
85 -- remove river id here because range_id references river already 85 -- remove river id here because range_id references river already
86 river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE, 86 river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
87 station NUMERIC NOT NULL, 87 station NUMERIC NOT NULL,
88 aeo NUMERIC NOT NULL, 88 aeo NUMERIC NOT NULL,
89 official_number int8 UNIQUE, 89 official_number int8,
90 90
91 -- Pegelnullpunkt 91 -- Pegelnullpunkt
92 datum NUMERIC NOT NULL, 92 datum NUMERIC NOT NULL,
93 -- Streckengueltigkeit 93 -- Streckengueltigkeit
94 range_id int NOT NULL REFERENCES ranges (id) ON DELETE CASCADE, 94 range_id int NOT NULL REFERENCES ranges (id) ON DELETE CASCADE,
95 95
96 UNIQUE (name, river_id), 96 UNIQUE (name, river_id),
97 UNIQUE (official_number, river_id),
97 UNIQUE (river_id, station) 98 UNIQUE (river_id, station)
98 ); 99 );
99 100
100 -- Type of a Hauptwert 'W', 'Q', 'D', etc. 101 -- Type of a Hauptwert 'W', 'Q', 'D', etc.
101 CREATE SEQUENCE MAIN_VALUE_TYPES_ID_SEQ; 102 CREATE SEQUENCE MAIN_VALUE_TYPES_ID_SEQ;

http://dive4elements.wald.intevation.org