- change all occurrences of slices.deleted to slices.is_deleted
[plcapi.git] / planetlab4.sql
index 1ae1461..136e7e1 100644 (file)
@@ -9,7 +9,7 @@
 --
 -- Copyright (C) 2006 The Trustees of Princeton University
 --
--- $Id: planetlab4.sql,v 1.35 2006/11/15 10:59:54 thierry Exp $
+-- $Id: planetlab4.sql,v 1.40 2006/11/17 10:43:17 thierry Exp $
 --
 
 --------------------------------------------------------------------------------
@@ -554,10 +554,10 @@ CREATE TABLE slices (
     created timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, -- Creation date
     expires timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP + '2 weeks', -- Expiration date
 
-    deleted boolean NOT NULL DEFAULT false
+    is_deleted boolean NOT NULL DEFAULT false
 ) WITH OIDS;
-CREATE INDEX slices_site_id_idx ON slices (site_id) WHERE deleted IS false;
-CREATE INDEX slices_name_idx ON slices (name) WHERE deleted IS false;
+CREATE INDEX slices_site_id_idx ON slices (site_id) WHERE is_deleted IS false;
+CREATE INDEX slices_name_idx ON slices (name) WHERE is_deleted IS false;
 
 -- Slivers
 CREATE TABLE slice_node (
@@ -591,6 +591,7 @@ CREATE VIEW site_slices AS
 SELECT site_id,
 array_accum(slice_id) AS slice_ids
 FROM slices
+WHERE is_deleted is false
 GROUP BY site_id;
 
 -- Slices - peer relationship
@@ -693,6 +694,7 @@ CREATE TABLE node_session (
 
 CREATE TABLE messages (
     message_id text PRIMARY KEY, -- Message name
+    subject text, -- Message summary
     template text, -- Message template
     enabled bool NOT NULL DEFAULT true -- Whether message is enabled
 ) WITH OIDS;
@@ -723,6 +725,7 @@ INSERT INTO object_types (object_type) VALUES ('BootState');
 INSERT INTO object_types (object_type) VALUES ('ConfFile');
 INSERT INTO object_types (object_type) VALUES ('KeyType');
 INSERT INTO object_types (object_type) VALUES ('Key');
+INSERT INTO object_types (object_type) VALUES ('Message');
 INSERT INTO object_types (object_type) VALUES ('NetworkMethod');
 INSERT INTO object_types (object_type) VALUES ('NetworkType');
 INSERT INTO object_types (object_type) VALUES ('Network');
@@ -737,6 +740,7 @@ INSERT INTO object_types (object_type) VALUES ('Site');
 INSERT INTO object_types (object_type) VALUES ('SliceAttributeType');
 INSERT INTO object_types (object_type) VALUES ('SliceAttribute');
 INSERT INTO object_types (object_type) VALUES ('Slice');
+INSERT INTO object_types (object_type) VALUES ('SliceInstantiation');
 INSERT INTO object_types (object_type) VALUES ('Unknown');
 
 -- Events
@@ -969,7 +973,7 @@ slices.url,
 slices.description,
 slices.max_nodes,
 slices.creator_person_id,
-slices.deleted,
+slices.is_deleted,
 CAST(date_part('epoch', slices.created) AS bigint) AS created,
 CAST(date_part('epoch', slices.expires) AS bigint) AS expires,
 COALESCE(slice_nodes.node_ids, '{}') AS node_ids,
@@ -993,7 +997,7 @@ slices.instantiation,
 slices.url,
 slices.description,
 slices.max_nodes,
-slices.deleted,
+slices.is_deleted,
 CAST(date_part('epoch', slices.created) AS bigint) AS created,
 CAST(date_part('epoch', slices.expires) AS bigint) AS expires,
 COALESCE(slice_nodes.node_ids, '{}') AS node_ids