summaryrefslogtreecommitdiff
path: root/src/odbc/pg.sql
blob: 9e0c154d9a5238f1514b4b2a90ff97a2da9026e9 (plain) (blame)
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
CREATE TABLE users (
    username text NOT NULL,
    "password" text NOT NULL
);


CREATE TABLE last (
    username text NOT NULL,
    seconds text NOT NULL,
    state text
);


CREATE TABLE rosterusers (
    username text NOT NULL,
    jid text NOT NULL,
    nick text,
    subscription character(1) NOT NULL,
    ask character(1) NOT NULL,
    server character(1) NOT NULL,
    subscribe text,
    "type" text
);



CREATE TABLE rostergroups (
    username text NOT NULL,
    jid text NOT NULL,
    grp text NOT NULL
);


CREATE TABLE spool (
    username text NOT NULL,
    xml text
);



CREATE TABLE vcard (
    username text NOT NULL,
    full_name text,
    first_name text,
    last_name text,
    nick_name text,
    url text,
    address1 text,
    address2 text,
    locality text,
    region text,
    pcode text,
    country text,
    telephone text,
    email text,
    orgname text,
    orgunit text,
    title text,
    role text,
    b_day date,
    descr text
);




CREATE INDEX i_users_login ON users USING btree (username, "password");

CREATE INDEX i_rosteru_user_jid ON rosterusers USING btree (username, jid);

CREATE INDEX i_rosteru_username ON rosterusers USING btree (username);

CREATE INDEX pk_rosterg_user_jid ON rostergroups USING btree (username, jid);

CREATE INDEX i_despool ON spool USING btree (username);

CREATE INDEX i_rosteru_jid ON rosterusers USING btree (jid);

ALTER TABLE ONLY users
    ADD CONSTRAINT users_pkey PRIMARY KEY (username);

ALTER TABLE ONLY last
    ADD CONSTRAINT last_pkey PRIMARY KEY (username);

ALTER TABLE ONLY vcard
    ADD CONSTRAINT vcard_pkey PRIMARY KEY (username);