diff flys-backend/doc/schema/postgresql.sql @ 170:88c14d5d45be

Added missing sequences. Deleted unsupported sqlite schema. flys-backend/trunk@1460 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 14 Mar 2011 11:31:00 +0000
parents 86a1bd9cc50e
children 4a83e14f40f9
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql.sql	Fri Mar 11 16:23:42 2011 +0000
+++ b/flys-backend/doc/schema/postgresql.sql	Mon Mar 14 11:31:00 2011 +0000
@@ -9,12 +9,16 @@
 );
 
 -- Bruecke, Haefen, etc.
+CREATE SEQUENCE ATTRIBUTES_ID_SEQ;
+
 CREATE TABLE attributes (
     id    int PRIMARY KEY NOT NULL,
     value VARCHAR(256)    NOT NULL UNIQUE
 );
 
 -- segments from/to at a river
+CREATE SEQUENCE RANGES_ID_SEQ;
+
 CREATE TABLE ranges (
     id       int PRIMARY KEY NOT NULL,
     river_id int             NOT NULL REFERENCES rivers(id),
@@ -24,6 +28,8 @@
 );
 
 -- Lage 'links', 'rechts', etc.
+CREATE SEQUENCE POSITIONS_ID_SEQ;
+
 CREATE TABLE positions (
     id    int PRIMARY KEY NOT NULL,
     value VARCHAR(256)    NOT NULL UNIQUE
@@ -31,6 +37,8 @@
 
 -- Some object (eg. Hafen) at a segment of river
 -- plus its position.
+CREATE SEQUENCE ANNOTATIONS_ID_SEQ;
+
 CREATE TABLE annotations (
     id           int PRIMARY KEY NOT NULL,
     range_id     int             NOT NULL REFERENCES ranges(id),
@@ -39,6 +47,8 @@
 );
 
 -- Pegel
+CREATE SEQUENCE GAUGES_ID_SEQ;
+
 CREATE TABLE gauges (
     id       int PRIMARY KEY NOT NULL,
     name     VARCHAR(256)    NOT NULL,
@@ -56,12 +66,16 @@
 );
 
 -- Type of a Hauptwert 'W', 'Q', 'D', etc.
+CREATE SEQUENCE MAIN_VALUE_TYPES_ID_SEQ;
+
 CREATE TABLE main_value_types (
     id   int PRIMARY KEY NOT NULL,
     name VARCHAR(256)    NOT NULL UNIQUE
 );
 
 --  Named type of a Hauptwert (eg. HQ100)
+CREATE SEQUENCE NAMED_MAIN_VALUES_ID_SEQ;
+
 CREATE TABLE named_main_values (
     id      int PRIMARY KEY NOT NULL,
     name    VARCHAR(256)    NOT NULL UNIQUE,
@@ -70,6 +84,8 @@
 );
 
 -- Table for time intervals
+CREATE SEQUENCE TIME_INTERVALS_ID_SEQ;
+
 CREATE TABLE time_intervals (
     id         int PRIMARY KEY NOT NULL,
     start_time TIMESTAMP       NOT NULL,
@@ -78,6 +94,8 @@
 );
 
 -- Stammdaten
+CREATE SEQUENCE MAIN_VALUES_ID_SEQ;
+
 CREATE TABLE main_values (
     id             int PRIMARY KEY NOT NULL,
     gauge_id       int NOT NULL REFERENCES gauges(id),
@@ -91,6 +109,8 @@
 );
 
 -- Abflusstafeln
+CREATE SEQUENCE DISCHARGE_TABLES_ID_SEQ;
+
 CREATE TABLE discharge_tables (
     id               int PRIMARY KEY NOT NULL,
     gauge_id         int NOT NULL REFERENCES gauges(id),
@@ -102,6 +122,8 @@
 );
 
 -- Values of the Abflusstafeln
+CREATE SEQUENCE DISCHARGE_TABLE_VALUES_ID_SEQ;
+
 CREATE TABLE discharge_table_values (
     id       int PRIMARY KEY NOT NULL,
     table_id int NOT NULL REFERENCES discharge_tables(id),
@@ -112,6 +134,8 @@
 );
 
 -- WST files
+CREATE SEQUENCE WST_ID_SEQ;
+
 CREATE TABLE wst (
     id          int PRIMARY KEY NOT NULL,
     river_id    int NOT NULL REFERENCES rivers(id),
@@ -121,6 +145,8 @@
 );
 
 -- columns of WST files
+CREATE SEQUENCE WST_COLUMN_ID_SEQ;
+
 CREATE TABLE wst_column (
     id          int PRIMARY KEY NOT NULL,
     wst_id      int NOT NULL REFERENCES wst(id),
@@ -133,6 +159,8 @@
 );
 
 -- w values in  WST file column
+CREATE SEQUENCE WST_COLUMN_VALUES_ID_SEQ;
+
 CREATE TABLE wst_column_values (
     id            int PRIMARY KEY NOT NULL,
     wst_column_id int NOT NULL REFERENCES wst_column(id),
@@ -144,6 +172,8 @@
 );
 
 -- bind q values to range
+CREATE SEQUENCE WST_Q_RANGES_ID_SEQ;
+
 CREATE TABLE wst_q_ranges (
     id       int PRIMARY KEY NOT NULL,
     range_id int NOT NULL REFERENCES ranges(id),
@@ -151,6 +181,8 @@
 );
 
 -- bind q ranges to wst columns
+CREATE SEQUENCE WST_COLUMN_Q_RANGES_ID_SEQ;
+
 CREATE TABLE wst_column_q_ranges (
     id             int PRIMARY KEY NOT NULL,
     wst_column_id  int NOT NULL REFERENCES wst_column(id),

http://dive4elements.wald.intevation.org