+FROM nodenetworks_ordered
+GROUP BY node_id;
+
+--------------------------------------------------------------------------------
+-- Slices
+--------------------------------------------------------------------------------
+
+CREATE TABLE slice_instantiations (
+ instantiation text PRIMARY KEY
+);
+INSERT INTO slice_instantiations (instantiation) VALUES ('not-instantiated'); -- Placeholder slice
+INSERT INTO slice_instantiations (instantiation) VALUES ('plc-instantiated'); -- Instantiated by Node Manager
+INSERT INTO slice_instantiations (instantiation) VALUES ('delegated'); -- Manually instantiated
+
+-- Slices
+CREATE TABLE slices (
+ slice_id serial PRIMARY KEY, -- Slice identifier
+ site_id integer REFERENCES sites, -- Site identifier
+ name text NOT NULL, -- Slice name
+ instantiation text REFERENCES slice_instantiations DEFAULT 'plc-instantiated', -- Slice state, e.g. plc-instantiated
+ url text, -- Project URL
+ description text, -- Project description
+
+ max_nodes integer NOT NULL DEFAULT 100, -- Maximum number of nodes that can be assigned to this slice
+
+ creator_person_id integer REFERENCES persons, -- Creator
+ 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
+
+ is_deleted boolean NOT NULL DEFAULT false
+);
+CREATE INDEX slices_site_id_key ON slices (site_id);
+CREATE INDEX slices_name_key ON slices (name);
+
+-- Slivers
+CREATE TABLE slice_node (
+ slice_id integer REFERENCES slices, -- Slice identifier
+ node_id integer REFERENCES nodes -- Node identifier
+);
+CREATE INDEX slice_node_slice_id_key ON slice_node (slice_id);
+CREATE INDEX slice_node_node_id_key ON slice_node (node_id);
+
+-- Synonym for slice_node
+CREATE VIEW slivers AS
+SELECT * FROM slice_node;
+
+-- Nodes in each slice
+CREATE VIEW slice_nodes AS
+SELECT slice_id,
+array_to_string(array_accum(node_id), ',') AS node_ids
+FROM slice_node
+GROUP BY slice_id;
+
+-- Slices on each node
+CREATE VIEW node_slices AS
+SELECT node_id,
+array_to_string(array_accum(slice_id), ',') AS slice_ids
+FROM slice_node