diff db/pubsub.sql @ 350:4d4575911060

sql (PostgreSQL): schema update: - added version check on top of update files, SQL will not be applied if the version is not the one expected - new db schema version (3) - added "presence" access_model in nodes - added "schema" column in nodes - converted items data to xml, this will allow the use of all XML functions PostgreSQL now needs to have been compiled with --with-libxml .
author Goffi <goffi@goffi.org>
date Fri, 08 Sep 2017 08:02:04 +0200
parents 98409ef42c94
children 1d93f94feee3
line wrap: on
line diff
--- a/db/pubsub.sql	Sun Aug 27 20:33:39 2017 +0200
+++ b/db/pubsub.sql	Fri Sep 08 08:02:04 2017 +0200
@@ -10,13 +10,14 @@
     node_type text NOT NULL DEFAULT 'leaf'
         CHECK (node_type IN ('leaf', 'collection')),
     access_model text NOT NULL DEFAULT 'open'
-        CHECK (access_model IN ('open', 'publisher-roster', 'whitelist', 'publish-only', 'self-publisher')),
+        CHECK (access_model IN ('open', 'presence', 'publisher-roster', 'whitelist', 'publish-only', 'self-publisher')),
     persist_items boolean,
     deliver_payloads boolean NOT NULL DEFAULT TRUE,
     send_last_published_item text NOT NULL DEFAULT 'on_sub'
         CHECK (send_last_published_item IN ('never', 'on_sub')),
     publish_model text NOT NULL DEFAULT 'publishers'
         CHECK (publish_model IN ('publishers', 'subscribers', 'open'))
+    schema xml;
 );
 
 /* we need 2 partial indexes to manage NULL value for PEP */
@@ -59,7 +60,7 @@
     node_id integer NOT NULL REFERENCES nodes ON DELETE CASCADE,
     item text NOT NULL,
     publisher text NOT NULL,
-    data text,
+    data xml,
     access_model text NOT NULL DEFAULT 'open'
         CHECK (access_model IN ('open', 'publisher-roster', 'whitelist')),
     date timestamp with time zone NOT NULL DEFAULT now(),
@@ -99,4 +100,4 @@
 	value text
 );
 
-INSERT INTO metadata VALUES ('version', '2');
+INSERT INTO metadata VALUES ('version', '3');