• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

processone / ejabberd / 1173

28 Oct 2025 11:02AM UTC coverage: 33.768% (-0.02%) from 33.79%
1173

push

github

badlop
CHANGELOG.md: Update to 25.10

15513 of 45940 relevant lines covered (33.77%)

1078.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/mod_pubsub_sql.erl
1
%%%----------------------------------------------------------------------
2
%%% ejabberd, Copyright (C) 2002-2025   ProcessOne
3
%%%
4
%%% This program is free software; you can redistribute it and/or
5
%%% modify it under the terms of the GNU General Public License as
6
%%% published by the Free Software Foundation; either version 2 of the
7
%%% License, or (at your option) any later version.
8
%%%
9
%%% This program is distributed in the hope that it will be useful,
10
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
11
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
%%% General Public License for more details.
13
%%%
14
%%% You should have received a copy of the GNU General Public License along
15
%%% with this program; if not, write to the Free Software Foundation, Inc.,
16
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
%%%
18
%%%----------------------------------------------------------------------
19
-module(mod_pubsub_sql).
20

21
%% API
22
-export([init/3]).
23
-export([sql_schemas/0]).
24

25
-include("ejabberd_sql_pt.hrl").
26

27
%%%===================================================================
28
%%% API
29
%%%===================================================================
30
init(_Host, ServerHost, _Opts) ->
31
    ejabberd_sql_schema:update_schema(ServerHost, ?MODULE, sql_schemas()),
6✔
32
    ok.
6✔
33

34
%%%===================================================================
35
%%% Internal functions
36
%%%===================================================================
37
sql_schemas() ->
38
    [#sql_schema{
6✔
39
        version = 1,
40
        tables =
41
            [#sql_table{
42
                name = <<"pubsub_node">>,
43
                columns =
44
                    [#sql_column{name = <<"host">>, type = text},
45
                     #sql_column{name = <<"node">>, type = text},
46
                     #sql_column{name = <<"parent">>, type = text,
47
                                 default = true},
48
                     #sql_column{name = <<"plugin">>, type = text},
49
                     #sql_column{name = <<"nodeid">>, type = bigserial}],
50
                indices = [#sql_index{
51
                              columns = [<<"nodeid">>],
52
                              unique = true},
53
                           #sql_index{
54
                              columns = [<<"parent">>]},
55
                           #sql_index{
56
                              columns = [<<"host">>, <<"node">>],
57
                              unique = true}]},
58
             #sql_table{
59
                name = <<"pubsub_node_option">>,
60
                columns =
61
                    [#sql_column{name = <<"nodeid">>, type = bigint,
62
                                 opts = [#sql_references{
63
                                            table = <<"pubsub_node">>,
64
                                            column = <<"nodeid">>}]},
65
                     #sql_column{name = <<"name">>, type = text},
66
                     #sql_column{name = <<"val">>, type = text}],
67
                indices = [#sql_index{columns = [<<"nodeid">>]}]},
68
             #sql_table{
69
                name = <<"pubsub_node_owner">>,
70
                columns =
71
                    [#sql_column{name = <<"nodeid">>, type = bigint,
72
                                 opts = [#sql_references{
73
                                            table = <<"pubsub_node">>,
74
                                            column = <<"nodeid">>}]},
75
                     #sql_column{name = <<"owner">>, type = text}],
76
                indices = [#sql_index{columns = [<<"nodeid">>]}]},
77
             #sql_table{
78
                name = <<"pubsub_state">>,
79
                columns =
80
                    [#sql_column{name = <<"nodeid">>, type = bigint,
81
                                 opts = [#sql_references{
82
                                            table = <<"pubsub_node">>,
83
                                            column = <<"nodeid">>}]},
84
                     #sql_column{name = <<"jid">>, type = text},
85
                     #sql_column{name = <<"affiliation">>, type = {char, 1}},
86
                     #sql_column{name = <<"subscriptions">>, type = text,
87
                                 default = true},
88
                     #sql_column{name = <<"stateid">>, type = bigserial}],
89
                indices = [#sql_index{columns = [<<"stateid">>],
90
                                      unique = true},
91
                           #sql_index{columns = [<<"jid">>]},
92
                           #sql_index{columns = [<<"nodeid">>, <<"jid">>],
93
                                      unique = true}]},
94
             #sql_table{
95
                name = <<"pubsub_item">>,
96
                columns =
97
                    [#sql_column{name = <<"nodeid">>, type = bigint,
98
                                 opts = [#sql_references{
99
                                            table = <<"pubsub_node">>,
100
                                            column = <<"nodeid">>}]},
101
                     #sql_column{name = <<"itemid">>, type = text},
102
                     #sql_column{name = <<"publisher">>, type = text},
103
                     #sql_column{name = <<"creation">>, type = {text, 32}},
104
                     #sql_column{name = <<"modification">>, type = {text, 32}},
105
                     #sql_column{name = <<"payload">>, type = {text, big},
106
                                 default = true}],
107
                indices = [#sql_index{columns = [<<"nodeid">>, <<"itemid">>],
108
                                      unique = true},
109
                           #sql_index{columns = [<<"itemid">>]}]},
110
             #sql_table{
111
                name = <<"pubsub_subscription_opt">>,
112
                columns =
113
                    [#sql_column{name = <<"subid">>, type = text},
114
                     #sql_column{name = <<"opt_name">>, type = {text, 32}},
115
                     #sql_column{name = <<"opt_value">>, type = text}],
116
                indices = [#sql_index{columns = [<<"subid">>, <<"opt_name">>],
117
                                      unique = true}]}]}].
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc