From 0ed52020eb190fa9a1d40d3fca57c2d886808276 Mon Sep 17 00:00:00 2001
From: Sonia Zorba <sonia.zorba@inaf.it>
Date: Wed, 20 Jan 2021 17:31:38 +0100
Subject: [PATCH] Added structured NodeType and list_of_files table

---
 00-init.sql          |  2 +-
 07-list-of-files.sql | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 07-list-of-files.sql

diff --git a/00-init.sql b/00-init.sql
index f02254b..c494603 100644
--- a/00-init.sql
+++ b/00-init.sql
@@ -29,7 +29,7 @@
 
 CREATE EXTENSION IF NOT EXISTS ltree;
 
-CREATE TYPE NodeType AS ENUM ('container', 'data', 'link');
+CREATE TYPE NodeType AS ENUM ('container', 'data', 'link', 'structured');
 CREATE TYPE LocationType AS ENUM ('virtual', 'tape', 'user', 'LBT');
 
 CREATE TABLE node (
diff --git a/07-list-of-files.sql b/07-list-of-files.sql
new file mode 100644
index 0000000..d991354
--- /dev/null
+++ b/07-list-of-files.sql
@@ -0,0 +1,10 @@
+
+-- Stores the content of StructuredDataNodes representing a list of files.
+
+CREATE TABLE list_of_files (
+    list_node_id     BIGSERIAL NOT NULL,
+    node_id          BIGSERIAL NOT NULL,
+    PRIMARY KEY (list_node_id, node_id),
+    FOREIGN KEY (list_node_id) REFERENCES node (node_id),
+    FOREIGN KEY (node_id) REFERENCES node (node_id)
+);
-- 
GitLab