diff --git a/datafiles/schema.sql b/datafiles/schema.sql new file mode 100644 index 0000000000000000000000000000000000000000..bbcf000de4150b0e5e68b16b43ba08bd8b2b25f3 --- /dev/null +++ b/datafiles/schema.sql @@ -0,0 +1,43 @@ +-- OpenNSA SQL Schema (PostgreSQL) + +CREATE TYPE label AS ( + label_type text, + label_value text +); + + +CREATE TABLE connections ( + id serial PRIMARY KEY, + connection_id text NOT NULL UNIQUE, + revision integer NOT NULL, + global_reservation_id text, + description text, + state text NOT NULL, + nsa text NOT NULL, + source_network text NOT NULL, + source_port text NOT NULL, + source_labels label[], + dest_network text NOT NULL, + dest_port text NOT NULL, + dest_labels label[], + start_time timestamp with time zone NOT NULL, + end_time timestamp with time zone NOT NULL, + bandwidth integer NOT NULL -- mbps +); + + +CREATE TABLE subconnections ( + id serial PRIMARY KEY, + provider_nsa text NOT NULL, + connection_id integer NOT NULL , + revision integer NOT NULL, + parent_connection_id integer NOT NULL REFERENCES connections(id), + source_network text NOT NULL, + source_port text NOT NULL, + source_labels label[], + dest_network text NOT NULL, + dest_port text NOT NULL, + dest_labels label[], + UNIQUE (provider_nsa, connection_id) +); +