quote value for all operators (thanks to Jordan for the fix)
[plcapi.git] / planetlab5.sql
index 411003a..a4ec891 100644 (file)
 --
 -- Copyright (C) 2006 The Trustees of Princeton University
 --
+-- NOTE: this file was first created for version 4.3, the filename might be confusing
+--
 -- $Id$
+-- $URL$
 --
 
 SET client_encoding = 'UNICODE';
@@ -298,7 +301,6 @@ CREATE TABLE nodes (
     ssh_rsa_key text,                                  -- SSH host key updated by Boot Manager
     key text,                                          -- Node key generated when boot file is downloaded
        verified boolean NOT NULL DEFAULT false,                -- whether or not the node & pcu are verified
-       extrainfo text,
 
     -- Timestamps
     date_created timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -460,23 +462,10 @@ CREATE OR REPLACE VIEW view_ilinks AS
 SELECT * FROM tag_types 
 INNER JOIN ilink USING (tag_type_id);
 
--- expose node_ids ???
--- -- cannot mention the same table twice in a join ?
--- -- CREATE OR REPLACE VIEW ilink_src_node AS 
--- SELECT 
--- ilink.tag_type_id,
--- ilink.src_interface_id,
--- interfaces.node_id AS src_node_id,
--- ilink.dst_interface_id
--- FROM ilink 
--- INNER JOIN interfaces ON ilink.src_interface_id = interfaces.interface_id;
--- 
--- CREATE OR REPLACE VIEW ilink_nodes AS
--- SELECT 
--- ilink_src_node.*,
--- interfaces.node_id as dst_node_id
--- FROM ilink_src_node
--- INNER JOIN interfaces ON ilink_src_node.dst_interface_id = interfaces.interface_id;
+-- xxx TODO : expose to view_interfaces the set of ilinks a given interface is part of
+-- this is needed for properly deleting these ilinks when an interface gets deleted
+-- as this is not done yet, it prevents DeleteInterface, thus DeleteNode, thus DeleteSite
+-- from working correctly when an iLink is set
 
 --------------------------------------------------------------------------------
 -- Node groups
@@ -780,7 +769,7 @@ CREATE INDEX initscripts_name_idx ON initscripts (name);
 -- Peers
 CREATE TABLE peers (
     peer_id serial PRIMARY KEY,                                -- Peer identifier
-    peername text UNIQUE NOT NULL,                     -- Peer name
+    peername text NOT NULL,                            -- Peer name
     peer_url text NOT NULL,                            -- (HTTPS) URL of the peer PLCAPI interface
     cacert text,                                       -- (SSL) Public certificate of peer API server
     key text,                                          -- (GPG) Public key used for authentication
@@ -1091,7 +1080,6 @@ nodes.model,
 nodes.boot_nonce,
 nodes.version,
 nodes.verified,
-nodes.extrainfo,
 nodes.ssh_rsa_key,
 nodes.key,
 CAST(date_part('epoch', nodes.date_created) AS bigint) AS date_created,