File: db-setup.pgsql

package info (click to toggle)
jabberd2 2.7.0-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,196 kB
  • sloc: ansic: 37,104; sh: 1,100; perl: 656; xml: 561; makefile: 511; python: 238; ruby: 145; sql: 55
file content (224 lines) | stat: -rw-r--r-- 5,270 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
--
-- This is the required schema for PostgreSQL. Load this into the
-- database using the psql interactive terminal:
--
--     template1=> \i db-setup.pgsql
--

-- CREATE DATABASE jabberd2;
-- \c jabberd2

CREATE SEQUENCE "object-sequence";

--
-- c2s authentication/registration table
--
CREATE TABLE "authreg" (
    "username" varchar(1023) NOT NULL,
    "realm" varchar(1023) NOT NULL,
    "password" varchar(256),
    PRIMARY KEY ("username", "realm") );

CREATE INDEX i_authreg_username ON "authreg"("username");
CREATE INDEX i_authreg_realm ON "authreg"("realm");

--
-- Session manager tables 
--

--
-- Active (seen) users
-- Used by: core
--
CREATE TABLE "active" (
    "collection-owner" text PRIMARY KEY,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "time" integer NOT NULL DEFAULT 0 );

--
-- Logout times
-- Used by: mod_iq_last
--
CREATE TABLE "logout" (
    "collection-owner" text PRIMARY KEY,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "time" integer NOT NULL DEFAULT 0 );

--
-- Roster items
-- Used by: mod_roster
--
CREATE TABLE "roster-items" (
    "collection-owner" text NOT NULL,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "jid" text NOT NULL,
    "name" text,
    "to" boolean NOT NULL,
    "from" boolean NOT NULL,
    "ask" integer NOT NULL,
    PRIMARY KEY ("collection-owner", "jid") );

CREATE INDEX i_rosteri_owner ON "roster-items"("collection-owner");

--
-- Roster groups
-- Used by: mod_roster
--
CREATE TABLE "roster-groups" (
    "collection-owner" text NOT NULL,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "jid" text NOT NULL,
    "group" text NOT NULL,
    PRIMARY KEY ("collection-owner", "jid", "group") );

CREATE INDEX i_rosterg_owner ON "roster-groups"("collection-owner");
CREATE INDEX i_rosterg_owner_jid ON "roster-groups"("collection-owner", "jid");

--
-- vCard (user profile information)
-- Used by: mod_iq_vcard
--
CREATE TABLE "vcard" (
    "collection-owner" text PRIMARY KEY,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "fn" text,
    "nickname" text,
    "url" text,
    "tel" text,
    "email" text,
    "jabberid" text,
    "mailer" text,
    "title" text,
    "role" text,
    "bday" text,
    "tz" text,
    "n-family" text,
    "n-given" text,
    "n-middle" text,
    "n-prefix" text,
    "n-suffix" text,
    "adr-street" text,
    "adr-extadd" text,
    "adr-pobox" text,
    "adr-locality" text,
    "adr-region" text,
    "adr-pcode" text,
    "adr-country" text,
    "geo-lat" text,
    "geo-lon" text,
    "org-orgname" text,
    "org-orgunit" text,
    "agent-extval" text,
    "sort-string" text,
    "desc" text,
    "note" text,
    "uid" text,
    
    "photo-type" text,
    "photo-binval" text,
    "photo-extval" text,
    
    "logo-type" text,
    "logo-binval" text,
    "logo-extval" text,
    
    "sound-phonetic" text,
    "sound-binval" text,
    "sound-extval" text,
    
    "key-type" text,
    "key-cred" text,
    
    "rev" text
    );

--
-- Offline message queue
-- Used by: mod_offline
--
CREATE TABLE "queue" (
    "collection-owner" text NOT NULL,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "xml" text NOT NULL );

CREATE INDEX i_queue_owner ON "queue"("collection-owner");

--
-- Private XML storage
-- Used by: mod_iq_private
--
CREATE TABLE "private" (
    "collection-owner" text NOT NULL,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "ns" text,
    "xml" text,
    PRIMARY KEY ("collection-owner", "ns") );

CREATE INDEX i_private_owner ON "private"("collection-owner");

--
-- Message Of The Day (MOTD) messages (announcements)
-- Used by: mod_announce
--
CREATE TABLE "motd-message" (
    "collection-owner" text PRIMARY KEY,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "xml" text NOT NULL);

--
-- Times of last MOTD message for each user
-- Used by: mod_announce
--
CREATE TABLE "motd-times" (
    "collection-owner" text PRIMARY KEY,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "time" integer NOT NULL);

--
-- Default privacy list
-- Used by: mod_privacy
--
CREATE TABLE "privacy-default" (
    "collection-owner" text PRIMARY KEY,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "default" text );

--
-- Privacy lists
-- Used by: mod_privacy
--
CREATE TABLE "privacy-items" (
    "collection-owner" text NOT NULL,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "list" text NOT NULL,
    "type" text,
    "value" text,
    "deny" boolean,
    "order" integer,
    "block" integer );

CREATE INDEX i_privacyi_owner ON "privacy-items"("collection-owner");

--
-- Vacation settings
-- Used by: mod_vacation
--
CREATE TABLE "vacation-settings" (
    "collection-owner" text PRIMARY KEY,
    "object-sequence" bigint DEFAULT nextval('object-sequence'),
    "start" integer,
    "end" integer,
    "message" text );

--
-- User status information
-- Used by: mod_status
--
CREATE TABLE "status" (
    "collection-owner" text PRIMARY KEY,
    "object-sequence" bigint,
    "status" text NOT NULL,
    "show" text,
    "last-login" int DEFAULT '0',
    "last-logout" int DEFAULT '0',
    "xml" text );