From b5b51424dbd1d2da6b98098e98c9d0b2b4908141 Mon Sep 17 00:00:00 2001
From: schroeder5 <s.schroeder@fz-juelich.de>
Date: Thu, 4 Jun 2020 17:46:05 +0200
Subject: [PATCH] #3: extension toar_controlled_vocabulary has been created
 (first examples role codes and role status)

---
 .../toar_controlled_vocabulary-0.1/Makefile   |  6 +++
 .../toar_controlled_vocabulary--0.1.sql       | 38 +++++++++++++++++++
 .../toar_controlled_vocabulary.control        |  5 +++
 3 files changed, 49 insertions(+)
 create mode 100644 extension/toar_controlled_vocabulary-0.1/Makefile
 create mode 100644 extension/toar_controlled_vocabulary-0.1/toar_controlled_vocabulary--0.1.sql
 create mode 100644 extension/toar_controlled_vocabulary-0.1/toar_controlled_vocabulary.control

diff --git a/extension/toar_controlled_vocabulary-0.1/Makefile b/extension/toar_controlled_vocabulary-0.1/Makefile
new file mode 100644
index 0000000..b3758af
--- /dev/null
+++ b/extension/toar_controlled_vocabulary-0.1/Makefile
@@ -0,0 +1,6 @@
+EXTENSION = toar_controlled_vocabulary
+DATA = toar_controlled_vocabulary--0.1.sql
+
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
diff --git a/extension/toar_controlled_vocabulary-0.1/toar_controlled_vocabulary--0.1.sql b/extension/toar_controlled_vocabulary-0.1/toar_controlled_vocabulary--0.1.sql
new file mode 100644
index 0000000..ca9eefb
--- /dev/null
+++ b/extension/toar_controlled_vocabulary-0.1/toar_controlled_vocabulary--0.1.sql
@@ -0,0 +1,38 @@
+--
+-- contrib/toar_controlled_vocabulary.sql
+--
+-- [Step to install]
+--
+-- 1. 
+--
+
+-- INSTALL VERSION: '0.1'
+
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION toar_controlled_vocabulary" to load this file. \quit
+
+CREATE TABLE IF NOT EXISTS RC_vocabulary (
+    enum_val INT NOT NULL,
+    enum_str character varying(128) NOT NULL, 
+    PRIMARY KEY(enum_val, enum_str)
+);
+
+INSERT INTO RC_vocabulary (enum_val, enum_str) VALUES
+    (0, 'PointOfContact'),
+    (1, 'PrincipalInvestigator'),
+    (2, 'Originator'),
+    (3, 'Contributor'),
+    (4, 'Collaborator'),
+    (5, 'ResourceProvider');
+
+CREATE TABLE IF NOT EXISTS RS_vocabulary (
+    enum_val INT NOT NULL,
+    enum_str character varying(128) NOT NULL,
+    PRIMARY KEY(enum_val, enum_str)
+);      
+
+INSERT INTO RS_vocabulary (enum_val, enum_str) VALUES
+    (0, 'active'),
+    (1, 'inactive'),
+    (2, 'unknown');
+
diff --git a/extension/toar_controlled_vocabulary-0.1/toar_controlled_vocabulary.control b/extension/toar_controlled_vocabulary-0.1/toar_controlled_vocabulary.control
new file mode 100644
index 0000000..7c67f0f
--- /dev/null
+++ b/extension/toar_controlled_vocabulary-0.1/toar_controlled_vocabulary.control
@@ -0,0 +1,5 @@
+# toar_controlled_vocabulary extension
+comment = 'TOAR controlled vocabulary'
+default_version = '0.1'
+module_pathname = '$libdir/toar_controlled_vocabulary-0.1'
+relocatable = false
-- 
GitLab