comparison db/pubsub.sql @ 478:b544109ab4c4

Privileged Entity update + Pubsub Account Management partial implementation + Public Pubsub Subscription /!\ pgsql schema needs to be updated /!\ /!\ server conf needs to be updated for privileged entity: only the new `urn:xmpp:privilege:2` namespace is handled now /!\ Privileged entity has been updated to hanlde the new namespace and IQ permission. Roster pushes are not managed yet. XEP-0376 (Pubsub Account Management) is partially implemented. The XEP is not fully specified at the moment, and my messages on standard@ haven't seen any reply. Thus for now only "Subscribing", "Unsubscribing" and "Listing Subscriptions" is implemented, "Auto Subscriptions" and "Filtering" is not. Public Pubsub Subscription (https://xmpp.org/extensions/inbox/pubsub-public-subscriptions.html) is implemented; the XEP has been accepted by council but is not yet published. It will be updated to use subscription options instead of the <public> element actually specified, I'm waiting for publication to update the XEP. unsubscribe has been updated to return the `<subscription>` element as expected by XEP-0060 (sat_tmp needs to be updated). database schema has been updated to add columns necessary to keep track of subscriptions to external nodes and to mark subscriptions as public.
author Goffi <goffi@goffi.org>
date Wed, 11 May 2022 13:39:08 +0200
parents 0d38c3529972
children cfa40fa108a4
comparison
equal deleted inserted replaced
477:9125a6e440c0 478:b544109ab4c4
13 CHECK (access_model IN ('open', 'presence', 'publisher-roster', 'whitelist', 'publish-only', 'self-publisher')), 13 CHECK (access_model IN ('open', 'presence', 'publisher-roster', 'whitelist', 'publish-only', 'self-publisher')),
14 persist_items boolean, 14 persist_items boolean,
15 deliver_payloads boolean NOT NULL DEFAULT TRUE, 15 deliver_payloads boolean NOT NULL DEFAULT TRUE,
16 max_items integer NOT NULL DEFAULT 0 16 max_items integer NOT NULL DEFAULT 0
17 CHECK (max_items >= 0), 17 CHECK (max_items >= 0),
18 overwrite_policy text NOT NULL DEFAULT 'original_publisher' 18 overwrite_policy text NOT NULL DEFAULT 'original_publisher'
19 CHECK (overwrite_policy IN ('original_publisher', 'any_publisher')), 19 CHECK (overwrite_policy IN ('original_publisher', 'any_publisher')),
20 serial_ids boolean NOT NULL DEFAULT FALSE, 20 serial_ids boolean NOT NULL DEFAULT FALSE,
21 consistent_publisher boolean NOT NULL DEFAULT FALSE, 21 consistent_publisher boolean NOT NULL DEFAULT FALSE,
22 fts_language text NOT NULL DEFAULT 'generic', 22 fts_language text NOT NULL DEFAULT 'generic',
23 send_last_published_item text NOT NULL DEFAULT 'on_sub' 23 send_last_published_item text NOT NULL DEFAULT 'on_sub'
24 CHECK (send_last_published_item IN ('never', 'on_sub')), 24 CHECK (send_last_published_item IN ('never', 'on_sub')),
51 51
52 CREATE TABLE subscriptions ( 52 CREATE TABLE subscriptions (
53 subscription_id serial PRIMARY KEY, 53 subscription_id serial PRIMARY KEY,
54 entity_id integer NOT NULL REFERENCES entities ON DELETE CASCADE, 54 entity_id integer NOT NULL REFERENCES entities ON DELETE CASCADE,
55 resource text, 55 resource text,
56 node_id integer NOT NULL REFERENCES nodes ON delete CASCADE, 56 node_id integer REFERENCES nodes ON DELETE CASCADE,
57 /* when we reference an external node (with PAM), node_id is NULL and service and node
58 * are set */
59 ext_service text,
60 ext_node text,
57 state text NOT NULL DEFAULT 'subscribed' 61 state text NOT NULL DEFAULT 'subscribed'
58 CHECK (state IN ('subscribed', 'pending', 'unconfigured')), 62 CHECK (state IN ('subscribed', 'pending', 'unconfigured')),
59 subscription_type text 63 subscription_type text
60 CHECK (subscription_type IN (NULL, 'items', 'nodes')), 64 CHECK (subscription_type IN (NULL, 'items', 'nodes')),
61 subscription_depth text 65 subscription_depth text
62 CHECK (subscription_depth IN (NULL, '1', 'all')), 66 CHECK (subscription_depth IN (NULL, '1', 'all')),
63 UNIQUE (entity_id, resource, node_id)); 67 public boolean NOT NULL DEFAULT FALSE,
68 UNIQUE (entity_id, resource, node_id)),
69 UNIQUE (entity_id, ext_service, ext_node)),
70 ;
64 71
65 CREATE TABLE items ( 72 CREATE TABLE items (
66 item_id serial PRIMARY KEY, 73 item_id serial PRIMARY KEY,
67 node_id integer NOT NULL REFERENCES nodes ON DELETE CASCADE, 74 node_id integer NOT NULL REFERENCES nodes ON DELETE CASCADE,
68 item text NOT NULL, 75 item text NOT NULL,
152 CREATE TABLE metadata ( 159 CREATE TABLE metadata (
153 key text PRIMARY KEY, 160 key text PRIMARY KEY,
154 value text 161 value text
155 ); 162 );
156 163
157 INSERT INTO metadata VALUES ('version', '9'); 164 INSERT INTO metadata VALUES ('version', '10');