--
-- Copyright (C) 2006 The Trustees of Princeton University
--
--- $Id: planetlab4.sql,v 1.43 2006/11/23 19:35:38 thierry Exp $
+-- $Id: planetlab4.sql,v 1.46 2006/11/27 12:18:12 thierry Exp $
--
--------------------------------------------------------------------------------
-- Timestamps
date_created timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
- last_updated timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP
+ last_updated timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
+
+ peer_id integer REFERENCES peers -- From which peer
) WITH OIDS;
CREATE INDEX sites_login_base_idx ON sites (login_base) WHERE deleted IS false;
attribute_type_id serial PRIMARY KEY, -- Attribute type identifier
name text UNIQUE NOT NULL, -- Attribute name
description text, -- Attribute description
- min_role_id integer REFERENCES roles DEFAULT 10 -- If set, minimum (least powerful) role that can set or change this attribute
+ min_role_id integer REFERENCES roles DEFAULT 10, -- If set, minimum (least powerful) role that can set or change this attribute
+
+ peer_id integer REFERENCES peers -- From which peer
) WITH OIDS;
-- Slice/sliver attributes
slice_id integer REFERENCES slices NOT NULL, -- Slice identifier
node_id integer REFERENCES nodes, -- Sliver attribute if set
attribute_type_id integer REFERENCES slice_attribute_types NOT NULL, -- Attribute type identifier
- value text
+ value text,
+
+ peer_id integer REFERENCES peers -- From which peer
) WITH OIDS;
CREATE INDEX slice_attribute_slice_id_idx ON slice_attribute (slice_id);
CREATE INDEX slice_attribute_node_id_idx ON slice_attribute (node_id);
sites.latitude,
sites.longitude,
sites.url,
+sites.peer_id,
CAST(date_part('epoch', sites.date_created) AS bigint) AS date_created,
CAST(date_part('epoch', sites.last_updated) AS bigint) AS last_updated,
COALESCE(site_persons.person_ids, '{}') AS person_ids,
slice_attribute_types.name,
slice_attribute_types.description,
slice_attribute_types.min_role_id,
-slice_attribute.value
+slice_attribute.value,
+slice_attribute.peer_id
FROM slice_attribute
INNER JOIN slice_attribute_types USING (attribute_type_id);