Browse code

- replace manual generated SQL schemes for oracle with the ones created from the XSL infrastructure

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4078 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 24/04/2008 10:19:40
Showing 25 changed files
... ...
@@ -1,45 +1,44 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('acc',4);
2
-create table ACC
3
-(
4
-  ID         NUMBER(10) not null,
5
-  METHOD     VARCHAR2(16) DEFAULT '',
6
-  FROM_TAG   VARCHAR2(64) DEFAULT '',
7
-  TO_TAG     VARCHAR2(64) DEFAULT '',
8
-  CALLID     VARCHAR2(64) DEFAULT '',
9
-  SIP_CODE   VARCHAR2(3) DEFAULT '',
10
-  SIP_REASON VARCHAR2(32) DEFAULT '',
11
-  TIME       DATE not null
1
+INSERT INTO version (table_name, table_version) values ('acc','4');
2
+CREATE TABLE acc (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    method VARCHAR2(16) DEFAULT '',
5
+    from_tag VARCHAR2(64) DEFAULT '',
6
+    to_tag VARCHAR2(64) DEFAULT '',
7
+    callid VARCHAR2(64) DEFAULT '',
8
+    sip_code VARCHAR2(3) DEFAULT '',
9
+    sip_reason VARCHAR2(32) DEFAULT '',
10
+    time DATE
12 11
 );
13
-alter table ACC add constraint PK_ACC primary key (ID);
14
-create index ACC_CALLID_IDX on ACC (CALLID);
15
-create or replace trigger acc_tr
12
+
13
+CREATE OR REPLACE TRIGGER acc_tr
16 14
 before insert on acc FOR EACH ROW
17 15
 BEGIN
18 16
   auto_id(:NEW.id);
19 17
 END acc_tr;
20 18
 /
21
-BEGIN map2users('ACC'); END;
19
+BEGIN map2users('acc'); END;
22 20
 /
21
+CREATE INDEX acc_callid_idx  ON acc (callid);
23 22
 
24
-INSERT INTO VERSION (table_name,table_version) values ('missed_calls',3);
25
-create table MISSED_CALLS
26
-(
27
-  ID         NUMBER(10) not null,
28
-  METHOD     VARCHAR2(16) DEFAULT '',
29
-  FROM_TAG   VARCHAR2(64) DEFAULT '',
30
-  TO_TAG     VARCHAR2(64) DEFAULT '',
31
-  CALLID     VARCHAR2(64) DEFAULT '',
32
-  SIP_CODE   VARCHAR2(3) DEFAULT '',
33
-  SIP_REASON VARCHAR2(32) DEFAULT '',
34
-  TIME       DATE not null
23
+INSERT INTO version (table_name, table_version) values ('missed_calls','3');
24
+CREATE TABLE missed_calls (
25
+    id NUMBER(10) PRIMARY KEY,
26
+    method VARCHAR2(16) DEFAULT '',
27
+    from_tag VARCHAR2(64) DEFAULT '',
28
+    to_tag VARCHAR2(64) DEFAULT '',
29
+    callid VARCHAR2(64) DEFAULT '',
30
+    sip_code VARCHAR2(3) DEFAULT '',
31
+    sip_reason VARCHAR2(32) DEFAULT '',
32
+    time DATE
35 33
 );
36
-alter table MISSED_CALLS add constraint PK_MISSED_CALLS primary key (ID);
37
-create index MISSED_CALLS_CALLID_IDX on MISSED_CALLS (CALLID);
38
-create or replace trigger missed_calls_tr
34
+
35
+CREATE OR REPLACE TRIGGER missed_calls_tr
39 36
 before insert on missed_calls FOR EACH ROW
40 37
 BEGIN
41 38
   auto_id(:NEW.id);
42 39
 END missed_calls_tr;
43 40
 /
44
-BEGIN map2users('MISSED_CALLS'); END;
41
+BEGIN map2users('missed_calls'); END;
45 42
 /
43
+CREATE INDEX missed_calls_callid_idx  ON missed_calls (callid);
44
+
... ...
@@ -1,20 +1,20 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('dbaliases',1);
2
-create table DBALIASES
3
-(
4
-  ID             NUMBER(10) not null,
5
-  ALIAS_USERNAME VARCHAR2(64) DEFAULT '',
6
-  ALIAS_DOMAIN   VARCHAR2(64) DEFAULT '',
7
-  USERNAME       VARCHAR2(64) DEFAULT '',
8
-  DOMAIN         VARCHAR2(64) DEFAULT ''
1
+INSERT INTO version (table_name, table_version) values ('dbaliases','1');
2
+CREATE TABLE dbaliases (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    alias_username VARCHAR2(64) DEFAULT '',
5
+    alias_domain VARCHAR2(64) DEFAULT '',
6
+    username VARCHAR2(64) DEFAULT '',
7
+    domain VARCHAR2(64) DEFAULT '',
8
+    CONSTRAINT dbaliases_alias_idx  UNIQUE (alias_username, alias_domain)
9 9
 );
10
-alter table DBALIASES add constraint PK_DBALIASES primary key (ID);
11
-alter table DBALIASES add constraint DBALIASES_ALIAS_IDX unique (ALIAS_USERNAME,ALIAS_DOMAIN);
12
-create index DBALIASES_TARGET_IDX on DBALIASES (USERNAME,DOMAIN);
13
-create or replace trigger dbaliases_tr
10
+
11
+CREATE OR REPLACE TRIGGER dbaliases_tr
14 12
 before insert on dbaliases FOR EACH ROW
15 13
 BEGIN
16 14
   auto_id(:NEW.id);
17 15
 END dbaliases_tr;
18 16
 /
19
-BEGIN map2users('DBALIASES'); END;
17
+BEGIN map2users('dbaliases'); END;
20 18
 /
19
+CREATE INDEX dbaliases_target_idx  ON dbaliases (username, domain);
20
+
... ...
@@ -1,23 +1,23 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('subscriber',6);
2
-create table SUBSCRIBER
3
-(
4
-  ID               NUMBER(10) not null,
5
-  USERNAME         VARCHAR2(64) default '',
6
-  DOMAIN           VARCHAR2(64) default '',
7
-  PASSWORD         VARCHAR2(25) default '',
8
-  EMAIL_ADDRESS    VARCHAR2(64) default '',
9
-  HA1              VARCHAR2(64) default '',
10
-  HA1B             VARCHAR2(64) default '',
11
-  RPID             VARCHAR2(64) default null
1
+INSERT INTO version (table_name, table_version) values ('subscriber','6');
2
+CREATE TABLE subscriber (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    username VARCHAR2(64) DEFAULT '',
5
+    domain VARCHAR2(64) DEFAULT '',
6
+    password VARCHAR2(25) DEFAULT '',
7
+    email_address VARCHAR2(64) DEFAULT '',
8
+    ha1 VARCHAR2(64) DEFAULT '',
9
+    ha1b VARCHAR2(64) DEFAULT '',
10
+    rpid VARCHAR2(64) DEFAULT NULL,
11
+    CONSTRAINT subscriber_account_idx  UNIQUE (username, domain)
12 12
 );
13
-alter table SUBSCRIBER add constraint PK_SUBSCRIBER primary key (ID);
14
-alter table SUBSCRIBER add constraint SUBSCRIBER_ACCOUNT_IDX unique (USERNAME,DOMAIN);
15
-create index SUBSCRIBER_USERNAME_IDX on SUBSCRIBER (USERNAME);
16
-create or replace trigger subscriber_tr
13
+
14
+CREATE OR REPLACE TRIGGER subscriber_tr
17 15
 before insert on subscriber FOR EACH ROW
18 16
 BEGIN
19 17
   auto_id(:NEW.id);
20 18
 END subscriber_tr;
21 19
 /
22
-BEGIN map2users('SUBSCRIBER'); END;
20
+BEGIN map2users('subscriber'); END;
23 21
 /
22
+CREATE INDEX subscriber_username_idx  ON subscriber (username);
23
+
... ...
@@ -1,23 +1,23 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('usr_preferences',2);
2
-create table USR_PREFERENCES
3
-(
4
-  ID            NUMBER(10) not null,
5
-  UUID          VARCHAR2(64) default '',
6
-  USERNAME      VARCHAR2(128) default 0,
7
-  DOMAIN        VARCHAR2(64) default '',
8
-  ATTRIBUTE     VARCHAR2(32) default '',
9
-  TYPE          NUMBER(10) default 0,
10
-  VALUE         VARCHAR2(128) default '',
11
-  LAST_MODIFIED DATE default to_date('01-JAN-1900 00:00:01','dd-mm-yyyy hh24:mi:ss')
1
+INSERT INTO version (table_name, table_version) values ('usr_preferences','2');
2
+CREATE TABLE usr_preferences (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    uuid VARCHAR2(64) DEFAULT '',
5
+    username VARCHAR2(128) DEFAULT 0 NOT NULL,
6
+    domain VARCHAR2(64) DEFAULT '',
7
+    attribute VARCHAR2(32) DEFAULT '',
8
+    type NUMBER(10) DEFAULT 0 NOT NULL,
9
+    value VARCHAR2(128) DEFAULT '',
10
+    last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss')
12 11
 );
13
-alter table USR_PREFERENCES add constraint PK_USR_PREFERENCES primary key (ID);
14
-create index USR_PREFERENCES_UA_IDX on USR_PREFERENCES (UUID,ATTRIBUTE);
15
-create index USR_PREFERENCES_UDA_IDX on USR_PREFERENCES (USERNAME,DOMAIN, ATTRIBUTE);
16
-create or replace trigger usr_preferences_tr
12
+
13
+CREATE OR REPLACE TRIGGER usr_preferences_tr
17 14
 before insert on usr_preferences FOR EACH ROW
18 15
 BEGIN
19 16
   auto_id(:NEW.id);
20 17
 END usr_preferences_tr;
21 18
 /
22
-BEGIN map2users('USR_PREFERENCES'); END;
19
+BEGIN map2users('usr_preferences'); END;
23 20
 /
21
+CREATE INDEX usr_preferences_ua_idx  ON usr_preferences (uuid, attribute);
22
+CREATE INDEX usr_preferences_uda_idx  ON usr_preferences (username, domain, attribute);
23
+
... ...
@@ -1,65 +1,60 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('carrierroute',2);
2
-create table CARRIERROUTE
3
-(
4
-  ID             NUMBER(10) not null,
5
-  CARRIER        NUMBER(10) default 0,
6
-  DOMAIN         VARCHAR2(64) default '',
7
-  SCAN_PREFIX    VARCHAR2(64) default '',
8
-  FLAGS		 NUMBER(11) default 0,
9
-  MASKS		 NUMBER(11) default 0,
10
-  PROB           NUMBER default 0,
11
-  STRIP          NUMBER(10) default 0,
12
-  REWRITE_HOST   VARCHAR2(128) default '',
13
-  REWRITE_PREFIX VARCHAR2(64) default '',
14
-  REWRITE_SUFFIX VARCHAR2(64) default '',
15
-  DESCRIPTION    VARCHAR2(255) default null
1
+INSERT INTO version (table_name, table_version) values ('carrierroute','2');
2
+CREATE TABLE carrierroute (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    carrier NUMBER(10) DEFAULT 0 NOT NULL,
5
+    domain VARCHAR2(64) DEFAULT '',
6
+    scan_prefix VARCHAR2(64) DEFAULT '',
7
+    flags NUMBER(10) DEFAULT 0 NOT NULL,
8
+    mask NUMBER(10) DEFAULT 0 NOT NULL,
9
+    prob NUMBER DEFAULT 0 NOT NULL,
10
+    strip NUMBER(10) DEFAULT 0 NOT NULL,
11
+    rewrite_host VARCHAR2(128) DEFAULT '',
12
+    rewrite_prefix VARCHAR2(64) DEFAULT '',
13
+    rewrite_suffix VARCHAR2(64) DEFAULT '',
14
+    description VARCHAR2(255) DEFAULT NULL
16 15
 );
17
-alter table CARRIERROUTE add constraint PK_CARRIERROUTE primary key (ID);
18
-create or replace trigger carrierroute_tr
16
+
17
+CREATE OR REPLACE TRIGGER carrierroute_tr
19 18
 before insert on carrierroute FOR EACH ROW
20 19
 BEGIN
21 20
   auto_id(:NEW.id);
22 21
 END carrierroute_tr;
23 22
 /
24
-BEGIN map2users('CARRIERROUTE'); END;
23
+BEGIN map2users('carrierroute'); END;
25 24
 /
26
-
27
-INSERT INTO VERSION (table_name,table_version) values ('carrierfailueroute',1);
28
-create table CARRIERFAILUREROUTE
29
-(
30
-  ID             NUMBER(10) not null,
31
-  CARRIER        NUMBER(10) default 0,
32
-  DOMAIN         VARCHAR2(64) default '',
33
-  SCAN_PREFIX    VARCHAR2(64) default '',
34
-  HOST_NAME      VARCHAR2(128) default '',
35
-  REPLY_CODE     VARCHAR2(3) default '',
36
-  FLAGS          NUMBER(11) default 0,
37
-  MASK           NUMBER(11) default 0,
38
-  NEXT_DOMAIN    VARCHAR2(64) default '',
39
-  DESCRIPTION    VARCHAR2(255) default null
25
+INSERT INTO version (table_name, table_version) values ('carrierfailureroute','1');
26
+CREATE TABLE carrierfailureroute (
27
+    id NUMBER(10) PRIMARY KEY,
28
+    carrier NUMBER(10) DEFAULT 0 NOT NULL,
29
+    domain VARCHAR2(64) DEFAULT '',
30
+    scan_prefix VARCHAR2(64) DEFAULT '',
31
+    host_name VARCHAR2(128) DEFAULT '',
32
+    reply_code VARCHAR2(3) DEFAULT '',
33
+    flags NUMBER(10) DEFAULT 0 NOT NULL,
34
+    mask NUMBER(10) DEFAULT 0 NOT NULL,
35
+    next_domain VARCHAR2(64) DEFAULT '',
36
+    description VARCHAR2(255) DEFAULT NULL
40 37
 );
41
-alter table CARRIERFAILUREROUTE add constraint PK_CARRIERFAILUREROUTE primary key (ID);
42
-create or replace trigger carrierfailureroute_tr
38
+
39
+CREATE OR REPLACE TRIGGER carrierfailureroute_tr
43 40
 before insert on carrierfailureroute FOR EACH ROW
44 41
 BEGIN
45 42
   auto_id(:NEW.id);
46 43
 END carrierfailureroute_tr;
47 44
 /
48
-BEGIN map2users('CARRIERFAILUREROUTE'); END;
45
+BEGIN map2users('carrierfailureroute'); END;
49 46
 /
50
-
51
-INSERT INTO VERSION (table_name,table_version) values ('route_tree',1);
52
-create table ROUTE_TREE
53
-(
54
-  ID      NUMBER(10) not null,
55
-  CARRIER VARCHAR2(64) default null
47
+INSERT INTO version (table_name, table_version) values ('route_tree','1');
48
+CREATE TABLE route_tree (
49
+    id NUMBER(10) PRIMARY KEY,
50
+    carrier VARCHAR2(64) DEFAULT NULL
56 51
 );
57
-alter table ROUTE_TREE add constraint PK_ROUTE_TREE primary key (ID);
58
-create or replace trigger route_tree_tr
52
+
53
+CREATE OR REPLACE TRIGGER route_tree_tr
59 54
 before insert on route_tree FOR EACH ROW
60 55
 BEGIN
61 56
   auto_id(:NEW.id);
62 57
 END route_tree_tr;
63 58
 /
64
-BEGIN map2users('ROUTE_TREE'); END;
59
+BEGIN map2users('route_tree'); END;
65 60
 /
... ...
@@ -1,19 +1,18 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('cpl',2);
2
-create table CPL
3
-(
4
-  ID       NUMBER(10) not null,
5
-  USERNAME VARCHAR2(64) not null,
6
-  DOMAIN   VARCHAR2(64) default '',
7
-  CPL_XML  VARCHAR2(1000),
8
-  CPL_BIN  VARCHAR2(1000)
1
+INSERT INTO version (table_name, table_version) values ('cpl','1');
2
+CREATE TABLE cpl (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    username VARCHAR2(64),
5
+    domain VARCHAR2(64) DEFAULT '',
6
+    cpl_xml CLOB,
7
+    cpl_bin CLOB,
8
+    CONSTRAINT cpl_account_idx  UNIQUE (username, domain)
9 9
 );
10
-alter table CPL add constraint PK_CPL primary key (ID);
11
-alter table CPL add constraint CPL_ACCOUNT_IDX unique (USERNAME,DOMAIN);
12
-create or replace trigger cpl_tr
10
+
11
+CREATE OR REPLACE TRIGGER cpl_tr
13 12
 before insert on cpl FOR EACH ROW
14 13
 BEGIN
15 14
   auto_id(:NEW.id);
16
-end cpl_tr;
15
+END cpl_tr;
17 16
 /
18
-BEGIN map2users('CPL'); END;
17
+BEGIN map2users('cpl'); END;
19 18
 /
... ...
@@ -1,33 +1,33 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('dialog',2);
2
-create table DIALOG
3
-(
4
-  ID               NUMBER(10) not null,
5
-  HASH_ENTRY       NUMBER(10) not null,
6
-  HASH_ID          NUMBER(10) not null,
7
-  CALLID           VARCHAR2(255) not null,
8
-  FROM_URI         VARCHAR2(128) not null,
9
-  FROM_TAG         VARCHAR2(64) not null,
10
-  TO_URI           VARCHAR2(128) not null,
11
-  TO_TAG           VARCHAR2(64) not null,
12
-  CALLER_CSEQ      VARCHAR2(7) not null,
13
-  CALLEE_CSEQ      VARCHAR2(7) not null,
14
-  CALLER_ROUTE_SET VARCHAR2(512),
15
-  CALLEE_ROUTE_SET VARCHAR2(512),
16
-  CALLER_CONTACT   VARCHAR2(128) not null,
17
-  CALLEE_CONTACT   VARCHAR2(128) not null,
18
-  CALLER_SOCK      VARCHAR2(64) not null,
19
-  CALLEE_SOCK      VARCHAR2(64) not null,
20
-  STATE            NUMBER(10) not null,
21
-  START_TIME       NUMBER(10) not null,
22
-  TIMEOUT          NUMBER(10) not null
1
+INSERT INTO version (table_name, table_version) values ('dialog','2');
2
+CREATE TABLE dialog (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    hash_entry NUMBER(10),
5
+    hash_id NUMBER(10),
6
+    callid VARCHAR2(255),
7
+    from_uri VARCHAR2(128),
8
+    from_tag VARCHAR2(64),
9
+    to_uri VARCHAR2(128),
10
+    to_tag VARCHAR2(64),
11
+    caller_cseq VARCHAR2(7),
12
+    callee_cseq VARCHAR2(7),
13
+    caller_route_set VARCHAR2(512),
14
+    callee_route_set VARCHAR2(512),
15
+    caller_contact VARCHAR2(128),
16
+    callee_contact VARCHAR2(128),
17
+    caller_sock VARCHAR2(64),
18
+    callee_sock VARCHAR2(64),
19
+    state NUMBER(10),
20
+    start_time NUMBER(10),
21
+    timeout NUMBER(10)
23 22
 );
24
-alter table DIALOG add constraint PK_DIALOG primary key (ID);
25
-create index DIALOG_HASH_IDX on DIALOG (HASH_ENTRY,HASH_ID);
26
-create or replace trigger dialog_tr
23
+
24
+CREATE OR REPLACE TRIGGER dialog_tr
27 25
 before insert on dialog FOR EACH ROW
28 26
 BEGIN
29 27
   auto_id(:NEW.id);
30 28
 END dialog_tr;
31 29
 /
32
-BEGIN map2users('DIALOG'); END;
30
+BEGIN map2users('dialog'); END;
33 31
 /
32
+CREATE INDEX dialog_hash_idx  ON dialog (hash_entry, hash_id);
33
+
... ...
@@ -1,18 +1,17 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('dispatcher',2);
2
-create table DISPATCHER
3
-(
4
-  ID          NUMBER(10) not null,
5
-  SETID       NUMBER(10) default 0,
6
-  DESTINATION VARCHAR2(192) default '',
7
-  FLAGS       NUMBER(11) default 0,
8
-  DESCRIPTION VARCHAR2(64) default ''
1
+INSERT INTO version (table_name, table_version) values ('dispatcher','2');
2
+CREATE TABLE dispatcher (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    setid NUMBER(10) DEFAULT 0 NOT NULL,
5
+    destination VARCHAR2(192) DEFAULT '',
6
+    flags NUMBER(10) DEFAULT 0 NOT NULL,
7
+    description VARCHAR2(64) DEFAULT ''
9 8
 );
10
-alter table DISPATCHER add constraint PK_DISPATCHER primary key (ID);
11
-create or replace trigger dispatcher_tr
9
+
10
+CREATE OR REPLACE TRIGGER dispatcher_tr
12 11
 before insert on dispatcher FOR EACH ROW
13 12
 BEGIN
14 13
   auto_id(:NEW.id);
15 14
 END dispatcher_tr;
16 15
 /
17
-BEGIN map2users('DISPATCHER'); END;
16
+BEGIN map2users('dispatcher'); END;
18 17
 /
... ...
@@ -1,17 +1,16 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('domain',1);
2
-create table DOMAIN
3
-(
4
-  ID            NUMBER(10) not null,
5
-  DOMAIN        VARCHAR2(64) default '',
6
-  LAST_MODIFIED DATE default to_date('01-JAN-1900 00:00:01','dd-mm-yyyy hh24:mi:ss')
1
+INSERT INTO version (table_name, table_version) values ('domain','1');
2
+CREATE TABLE domain (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    domain VARCHAR2(64) DEFAULT '',
5
+    last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'),
6
+    CONSTRAINT domain_domain_idx  UNIQUE (domain)
7 7
 );
8
-alter table DOMAIN add constraint PK_DOMAIN primary key (ID);
9
-alter table DOMAIN add constraint DOMAIN_DOMAIN_IDX unique (DOMAIN);
10
-create or replace trigger domain_tr
8
+
9
+CREATE OR REPLACE TRIGGER domain_tr
11 10
 before insert on domain FOR EACH ROW
12 11
 BEGIN
13 12
   auto_id(:NEW.id);
14 13
 END domain_tr;
15 14
 /
16
-BEGIN map2users('DOMAIN'); END;
15
+BEGIN map2users('domain'); END;
17 16
 /
... ...
@@ -1,21 +1,21 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('domainpolicy',2);
2
-create table DOMAINPOLICY
3
-(
4
-  ID          NUMBER(10) not null,
5
-  RULE        VARCHAR2(255) not null,
6
-  TYPE        VARCHAR2(255) not null,
7
-  ATT         VARCHAR2(255),
8
-  VAL         VARCHAR2(128),
9
-  DESCRIPTION VARCHAR2(255) not null
1
+INSERT INTO version (table_name, table_version) values ('domainpolicy','2');
2
+CREATE TABLE domainpolicy (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    rule VARCHAR2(255),
5
+    type VARCHAR2(255),
6
+    att VARCHAR2(255),
7
+    val VARCHAR2(128),
8
+    description VARCHAR2(255),
9
+    CONSTRAINT domainpolicy_rav_idx  UNIQUE (rule, att, val)
10 10
 );
11
-alter table DOMAINPOLICY add constraint PK_DOMAINPOLICY primary key (ID);
12
-alter table DOMAINPOLICY add constraint DOMAINPOLICY_RAV_IDX unique (RULE,ATT,VAL);
13
-create index DOMAINPOLICY_RULE_IDX on DOMAINPOLICY (RULE);
14
-create or replace trigger domainpolicy_tr
11
+
12
+CREATE OR REPLACE TRIGGER domainpolicy_tr
15 13
 before insert on domainpolicy FOR EACH ROW
16 14
 BEGIN
17 15
   auto_id(:NEW.id);
18 16
 END domainpolicy_tr;
19 17
 /
20
-BEGIN map2users('DOMAINPOLICY'); END;
18
+BEGIN map2users('domainpolicy'); END;
21 19
 /
20
+CREATE INDEX domainpolicy_rule_idx  ON domainpolicy (rule);
21
+
... ...
@@ -1,37 +1,35 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('grp',2);
2
-create table GRP
3
-(
4
-  ID            NUMBER(10) not null,
5
-  USERNAME      VARCHAR2(64) default '',
6
-  DOMAIN        VARCHAR2(64) default '',
7
-  GRP           VARCHAR2(64) default '',
8
-  LAST_MODIFIED DATE default to_date('01-JAN-1900 00:00:01','dd-mm-yyyy hh24:mi:ss')
1
+INSERT INTO version (table_name, table_version) values ('grp','2');
2
+CREATE TABLE grp (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    username VARCHAR2(64) DEFAULT '',
5
+    domain VARCHAR2(64) DEFAULT '',
6
+    grp VARCHAR2(64) DEFAULT '',
7
+    last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'),
8
+    CONSTRAINT grp_account_group_idx  UNIQUE (username, domain, grp)
9 9
 );
10
-alter table GRP add constraint PK_GRP primary key (ID);
11
-alter table GRP add constraint GRP_ACCOUNT_GROUP_IDX unique (USERNAME,DOMAIN,GRP);
12
-create or replace trigger grp_tr
10
+
11
+CREATE OR REPLACE TRIGGER grp_tr
13 12
 before insert on grp FOR EACH ROW
14 13
 BEGIN
15 14
   auto_id(:NEW.id);
16 15
 END grp_tr;
17 16
 /
18
-BEGIN map2users('GRP'); END;
17
+BEGIN map2users('grp'); END;
19 18
 /
20
-
21
-INSERT INTO VERSION (table_name,table_version) values ('re_grp',1);
22
-create table RE_GRP
23
-(
24
-  ID       NUMBER(10) not null,
25
-  REG_EXP  VARCHAR2(128) default '',
26
-  GROUP_ID NUMBER(10) default 0
19
+INSERT INTO version (table_name, table_version) values ('re_grp','1');
20
+CREATE TABLE re_grp (
21
+    id NUMBER(10) PRIMARY KEY,
22
+    reg_exp VARCHAR2(128) DEFAULT '',
23
+    group_id NUMBER(10) DEFAULT 0 NOT NULL
27 24
 );
28
-alter table RE_GRP add constraint PK_RE_GRP primary key (ID);
29
-create index RE_GRP_GROUP_IDX on RE_GRP (GROUP_ID);
30
-create or replace trigger re_grp_tr
25
+
26
+CREATE OR REPLACE TRIGGER re_grp_tr
31 27
 before insert on re_grp FOR EACH ROW
32 28
 BEGIN
33 29
   auto_id(:NEW.id);
34 30
 END re_grp_tr;
35 31
 /
36
-BEGIN map2users('RE_GRP'); END;
32
+BEGIN map2users('re_grp'); END;
37 33
 /
34
+CREATE INDEX re_grp_group_idx  ON re_grp (group_id);
35
+
... ...
@@ -1,38 +1,35 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('imc_rooms',1);
2
-create table IMC_ROOMS
3
-(
4
-  ID     NUMBER(10) not null,
5
-  NAME   VARCHAR2(64) not null,
6
-  DOMAIN VARCHAR2(64) not null,
7
-  FLAG   NUMBER(10) not null
1
+INSERT INTO version (table_name, table_version) values ('imc_rooms','1');
2
+CREATE TABLE imc_rooms (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    name VARCHAR2(64),
5
+    domain VARCHAR2(64),
6
+    flag NUMBER(10),
7
+    CONSTRAINT imc_rooms_name_domain_idx  UNIQUE (name, domain)
8 8
 );
9
-alter table IMC_ROOMS add constraint PK_IMC_ROOMS primary key (ID);
10
-alter table IMC_ROOMS add constraint IMC_ROOMS_NAME_DOMAIN_IDX unique (NAME,DOMAIN);
11
-create or replace trigger imc_rooms_tr
9
+
10
+CREATE OR REPLACE TRIGGER imc_rooms_tr
12 11
 before insert on imc_rooms FOR EACH ROW
13 12
 BEGIN
14 13
   auto_id(:NEW.id);
15 14
 END imc_rooms_tr;
16 15
 /
17
-BEGIN map2users('IMC_ROOMS'); END;
16
+BEGIN map2users('imc_rooms'); END;
18 17
 /
19
-
20
-INSERT INTO VERSION (table_name,table_version) values ('imc_members',1);
21
-create table IMC_MEMBERS
22
-(
23
-  ID       NUMBER(10) not null,
24
-  USERNAME VARCHAR2(64) not null,
25
-  DOMAIN   VARCHAR2(64) not null,
26
-  ROOM     VARCHAR2(64) not null,
27
-  FLAG     NUMBER(10) not null
18
+INSERT INTO version (table_name, table_version) values ('imc_members','1');
19
+CREATE TABLE imc_members (
20
+    id NUMBER(10) PRIMARY KEY,
21
+    username VARCHAR2(64),
22
+    domain VARCHAR2(64),
23
+    room VARCHAR2(64),
24
+    flag NUMBER(10),
25
+    CONSTRAINT imc_members_account_room_idx  UNIQUE (username, domain, room)
28 26
 );
29
-alter table IMC_MEMBERS add constraint PK_IMC_MEMBERS primary key (ID);
30
-alter table IMC_MEMBERS add constraint IMC_MEMBERS_ACCOUNT_ROOM_IDX unique (USERNAME,DOMAIN,ROOM);
31
-create or replace trigger imc_members_tr
27
+
28
+CREATE OR REPLACE TRIGGER imc_members_tr
32 29
 before insert on imc_members FOR EACH ROW
33 30
 BEGIN
34 31
   auto_id(:NEW.id);
35 32
 END imc_members_tr;
36 33
 /
37
-BEGIN map2users('IMC_MEMBERS'); END;
34
+BEGIN map2users('imc_members'); END;
38 35
 /
... ...
@@ -1,47 +1,46 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('gw',7);
2
-create table GW
3
-(
4
-  ID         NUMBER(10) not null,
5
-  GW_NAME    VARCHAR2(128) not null,
6
-  GRP_ID     NUMBER(10) not null,
7
-  IP_ADDR    VARCHAR2(15) not null,
8
-  PORT       NUMBER(5),
9
-  URI_SCHEME NUMBER(5),
10
-  TRANSPORT  NUMBER(5),
11
-  STRIP      NUMBER(5),
12
-  TAG        VARCHAR2(16) default null,
13
-  FLAGS      NUMBER(11) default 0
1
+INSERT INTO version (table_name, table_version) values ('gw','7');
2
+CREATE TABLE gw (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    gw_name VARCHAR2(128),
5
+    grp_id NUMBER(10),
6
+    ip_addr VARCHAR2(15),
7
+    port NUMBER(5),
8
+    uri_scheme NUMBER(5),
9
+    transport NUMBER(5),
10
+    strip NUMBER(5),
11
+    tag VARCHAR2(16) DEFAULT NULL,
12
+    flags NUMBER(10) DEFAULT 0 NOT NULL,
13
+    CONSTRAINT gw_gw_name_idx  UNIQUE (gw_name)
14 14
 );
15
-alter table GW add constraint PK_GW primary key (ID);
16
-alter table GW add constraint GW_NAME_IDX unique (GW_NAME);
17
-create index GW_GRP_ID_IDX on GW (GRP_ID);
18
-create or replace trigger gw_tr
15
+
16
+CREATE OR REPLACE TRIGGER gw_tr
19 17
 before insert on gw FOR EACH ROW
20 18
 BEGIN
21 19
   auto_id(:NEW.id);
22 20
 END gw_tr;
23 21
 /
24
-BEGIN map2users('GW'); END;
22
+BEGIN map2users('gw'); END;
25 23
 /
24
+CREATE INDEX gw_grp_id_idx  ON gw (grp_id);
26 25
 
27
-INSERT INTO VERSION (table_name,table_version) values ('lcr',2);
28
-create table LCR
29
-(
30
-  ID       NUMBER(10) not null,
31
-  PREFIX   VARCHAR2(16) default null,
32
-  FROM_URI VARCHAR2(64) default null,
33
-  GRP_ID   NUMBER(10) not null,
34
-  PRIORITY NUMBER(5) not null
26
+INSERT INTO version (table_name, table_version) values ('lcr','2');
27
+CREATE TABLE lcr (
28
+    id NUMBER(10) PRIMARY KEY,
29
+    prefix VARCHAR2(16) DEFAULT NULL,
30
+    from_uri VARCHAR2(64) DEFAULT NULL,
31
+    grp_id NUMBER(10),
32
+    priority NUMBER(5)
35 33
 );
36
-alter table LCR add constraint PK_LCR primary key (ID);
37
-create index LCR_FROM_URI_IDX on LCR (FROM_URI);
38
-create index LCR_GRP_ID_IDX on LCR (GRP_ID);
39
-create index LCR_PREFIX_IDX on LCR (PREFIX);
40
-create or replace trigger lcr_tr
34
+
35
+CREATE OR REPLACE TRIGGER lcr_tr
41 36
 before insert on lcr FOR EACH ROW
42 37
 BEGIN
43 38
   auto_id(:NEW.id);
44 39
 END lcr_tr;
45 40
 /
46
-BEGIN map2users('LCR'); END;
41
+BEGIN map2users('lcr'); END;
47 42
 /
43
+CREATE INDEX lcr_prefix_idx  ON lcr (prefix);
44
+CREATE INDEX lcr_from_uri_idx  ON lcr (from_uri);
45
+CREATE INDEX lcr_grp_id_idx  ON lcr (grp_id);
46
+
... ...
@@ -1,24 +1,24 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('silo',5);
2
-create table SILO
3
-(
4
-  ID       NUMBER(10) not null,
5
-  SRC_ADDR VARCHAR2(128) default '',
6
-  DST_ADDR VARCHAR2(128) default '',
7
-  USERNAME VARCHAR2(64) default '',
8
-  DOMAIN   VARCHAR2(64) default '',
9
-  INC_TIME NUMBER(10) default 0,
10
-  EXP_TIME NUMBER(10) default 0,
11
-  SND_TIME NUMBER(10) default 0,
12
-  CTYPE    VARCHAR2(32) default 'text/plain',
13
-  BODY     VARCHAR2(4000) default ''
1
+INSERT INTO version (table_name, table_version) values ('silo','5');
2
+CREATE TABLE silo (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    src_addr VARCHAR2(128) DEFAULT '',
5
+    dst_addr VARCHAR2(128) DEFAULT '',
6
+    username VARCHAR2(64) DEFAULT '',
7
+    domain VARCHAR2(64) DEFAULT '',
8
+    inc_time NUMBER(10) DEFAULT 0 NOT NULL,
9
+    exp_time NUMBER(10) DEFAULT 0 NOT NULL,
10
+    snd_time NUMBER(10) DEFAULT 0 NOT NULL,
11
+    ctype VARCHAR2(32) DEFAULT 'text/plain',
12
+    body BLOB DEFAULT ''
14 13
 );
15
-alter table SILO add constraint PK_SILO primary key (ID);
16
-create index SILO_ACCOUNT_IDX on SILO (USERNAME, DOMAIN);
17
-create or replace trigger silo_tr
14
+
15
+CREATE OR REPLACE TRIGGER silo_tr
18 16
 before insert on silo FOR EACH ROW
19 17
 BEGIN
20 18
   auto_id(:NEW.id);
21 19
 END silo_tr;
22 20
 /
23
-BEGIN map2users('SILO'); END;
21
+BEGIN map2users('silo'); END;
24 22
 /
23
+CREATE INDEX silo_account_idx  ON silo (username, domain);
24
+
... ...
@@ -1,18 +1,17 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('pdt',1);
2
-create table PDT
3
-(
4
-  ID      NUMBER(10) not null,
5
-  SDOMAIN VARCHAR2(128) not null,
6
-  PREFIX  VARCHAR2(32) not null,
7
-  DOMAIN  VARCHAR2(128) default ''
1
+INSERT INTO version (table_name, table_version) values ('pdt','1');
2
+CREATE TABLE pdt (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    sdomain VARCHAR2(128),
5
+    prefix VARCHAR2(32),
6
+    domain VARCHAR2(128) DEFAULT '',
7
+    CONSTRAINT pdt_sdomain_prefix_idx  UNIQUE (sdomain, prefix)
8 8
 );
9
-alter table PDT add constraint PK_PDT primary key (ID);
10
-alter table PDT add constraint PDT_SDOMAIN_PREFIX_IDX unique (SDOMAIN,PREFIX);
11
-create or replace trigger pdt_tr
9
+
10
+CREATE OR REPLACE TRIGGER pdt_tr
12 11
 before insert on pdt FOR EACH ROW
13 12
 BEGIN
14 13
   auto_id(:NEW.id);
15 14
 END pdt_tr;
16 15
 /
17
-BEGIN map2users('PDT'); END;
16
+BEGIN map2users('pdt'); END;
18 17
 /
... ...
@@ -1,38 +1,36 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('trusted',4);
2
-create table TRUSTED
3
-(
4
-  ID           NUMBER(10) not null,
5
-  SRC_IP       VARCHAR2(50) not null,
6
-  PROTO        VARCHAR2(4) not null,
7
-  FROM_PATTERN VARCHAR2(64) default null,
8
-  TAG          VARCHAR2(32)
1
+INSERT INTO version (table_name, table_version) values ('trusted','4');
2
+CREATE TABLE trusted (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    src_ip VARCHAR2(50),
5
+    proto VARCHAR2(4),
6
+    from_pattern VARCHAR2(64) DEFAULT NULL,
7
+    tag VARCHAR2(32)
9 8
 );
10
-alter table TRUSTED add constraint PK_TRUSTED primary key (ID);
11
-create index TRUSTED_PEER_IDX on TRUSTED (SRC_IP);
12
-create or replace trigger TRUSTED_tr
13
-before insert on TRUSTED FOR EACH ROW
9
+
10
+CREATE OR REPLACE TRIGGER trusted_tr
11
+before insert on trusted FOR EACH ROW
14 12
 BEGIN
15 13
   auto_id(:NEW.id);
16
-END TRUSTED_tr;
14
+END trusted_tr;
17 15
 /
18
-BEGIN map2users('TRUSTED'); END;
16
+BEGIN map2users('trusted'); END;
19 17
 /
18
+CREATE INDEX trusted_peer_idx  ON trusted (src_ip);
20 19
 
21
-INSERT INTO VERSION (table_name,table_version) values ('address',3);
22
-create table ADDRESS
23
-(
24
-  ID      NUMBER(10) not null,
25
-  GRP     NUMBER(5) default 0,
26
-  IP_ADDR VARCHAR2(15) not null,
27
-  MASK    NUMBER(5) default 32,
28
-  PORT    NUMBER(5) default 0
20
+INSERT INTO version (table_name, table_version) values ('address','3');
21
+CREATE TABLE address (
22
+    id NUMBER(10) PRIMARY KEY,
23
+    grp NUMBER(5) DEFAULT 0 NOT NULL,
24
+    ip_addr VARCHAR2(15),
25
+    mask NUMBER(5) DEFAULT 32 NOT NULL,
26
+    port NUMBER(5) DEFAULT 0 NOT NULL
29 27
 );
30
-alter table ADDRESS add constraint PK_ADDRESS primary key (ID);
31
-create or replace trigger address_tr
28
+
29
+CREATE OR REPLACE TRIGGER address_tr
32 30
 before insert on address FOR EACH ROW
33 31
 BEGIN
34 32
   auto_id(:NEW.id);
35 33
 END address_tr;
36 34
 /
37
-BEGIN map2users('ADDRESS'); END;
35
+BEGIN map2users('address'); END;
38 36
 /
... ...
@@ -1,138 +1,130 @@
1
-INSERT INTO VERSION (table_name,table_version) VALUES ('presentity',2);
2
-create table PRESENTITY
3
-(
4
-  ID            NUMBER(10) not null,
5
-  USERNAME      VARCHAR2(64) not null,
6
-  DOMAIN        VARCHAR2(64) not null,
7
-  EVENT         VARCHAR2(64) not null,
8
-  ETAG          VARCHAR2(64) not null,
9
-  EXPIRES       NUMBER(10) not null,
10
-  RECEIVED_TIME NUMBER(10) not null,
11
-  BODY          VARCHAR2(4000) not null
1
+INSERT INTO version (table_name, table_version) values ('presentity','2');
2
+CREATE TABLE presentity (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    username VARCHAR2(64),
5
+    domain VARCHAR2(64),
6
+    event VARCHAR2(64),
7
+    etag VARCHAR2(64),
8
+    expires NUMBER(10),
9
+    received_time NUMBER(10),
10
+    body BLOB,
11
+    CONSTRAINT presentity_presentity_idx  UNIQUE (username, domain, event, etag)
12 12
 );
13
-alter table PRESENTITY add constraint PK_PRESENTITY primary key (ID);
14
-alter table PRESENTITY add constraint PRESENTITY_PRESENTITY_IDX unique (USERNAME, DOMAIN, EVENT, ETAG);
15
-create or replace trigger presentity_tr
13
+
14
+CREATE OR REPLACE TRIGGER presentity_tr
16 15
 before insert on presentity FOR EACH ROW
17 16
 BEGIN
18 17
   auto_id(:NEW.id);
19 18
 END presentity_tr;
20 19
 /
21
-BEGIN map2users('PRESENTITY'); END;
20
+BEGIN map2users('presentity'); END;
22 21
 /
23
-
24
-INSERT INTO VERSION (table_name,table_version) VALUES ('active_watchers',9);
25
-create table ACTIVE_WATCHERS
26
-(
27
-  ID               NUMBER(10) not null,
28
-  PRESENTITY_URI   VARCHAR2(128) not null,
29
-  WATCHER_USERNAME VARCHAR2(64) not null,
30
-  WATCHER_DOMAIN   VARCHAR2(64) not null,
31
-  TO_USER          VARCHAR2(64) not null,
32
-  TO_DOMAIN        VARCHAR2(64) not null,
33
-  EVENT            VARCHAR2(64) default 'presence',
34
-  EVENT_ID         VARCHAR2(64),
35
-  TO_TAG           VARCHAR2(64) not null,
36
-  FROM_TAG         VARCHAR2(64) not null,
37
-  CALLID           VARCHAR2(64) not null,
38
-  LOCAL_CSEQ       NUMBER(10) not null,
39
-  REMOTE_CSEQ      NUMBER(10) not null,
40
-  CONTACT          VARCHAR2(64) not null,
41
-  RECORD_ROUTE     VARCHAR2(1000),
42
-  EXPIRES          NUMBER(10) not null,
43
-  STATUS           NUMBER(10) default 2,
44
-  REASON           VARCHAR2(64) not null,
45
-  VERSION          NUMBER(10) default 0,
46
-  SOCKET_INFO      VARCHAR2(64) not null,
47
-  LOCAL_CONTACT    VARCHAR2(128) not null
22
+INSERT INTO version (table_name, table_version) values ('active_watchers','9');
23
+CREATE TABLE active_watchers (
24
+    id NUMBER(10) PRIMARY KEY,
25
+    presentity_uri VARCHAR2(128),
26
+    watcher_username VARCHAR2(64),
27
+    watcher_domain VARCHAR2(64),
28
+    to_user VARCHAR2(64),
29
+    to_domain VARCHAR2(64),
30
+    event VARCHAR2(64) DEFAULT 'presence',
31
+    event_id VARCHAR2(64),
32
+    to_tag VARCHAR2(64),
33
+    from_tag VARCHAR2(64),
34
+    callid VARCHAR2(64),
35
+    local_cseq NUMBER(10),
36
+    remote_cseq NUMBER(10),
37
+    contact VARCHAR2(64),
38
+    record_route CLOB,
39
+    expires NUMBER(10),
40
+    status NUMBER(10) DEFAULT 2 NOT NULL,
41
+    reason VARCHAR2(64),
42
+    version NUMBER(10) DEFAULT 0 NOT NULL,
43
+    socket_info VARCHAR2(64),
44
+    local_contact VARCHAR2(128),
45
+    CONSTRAINT ORA_active_watchers_idx  UNIQUE (presentity_uri, callid, to_tag, from_tag)
48 46
 );
49
-alter table ACTIVE_WATCHERS add constraint PK_ACTIVE_WATCHERS primary key (ID);
50
-alter table ACTIVE_WATCHERS add constraint ACTIVE_WATCHERS_IDX unique (PRESENTITY_URI,CALLID,TO_TAG,FROM_TAG);
51
-create or replace trigger active_watchers_tr
47
+
48
+CREATE OR REPLACE TRIGGER active_watchers_tr
52 49
 before insert on active_watchers FOR EACH ROW
53 50
 BEGIN
54 51
   auto_id(:NEW.id);
55 52
 END active_watchers_tr;
56 53
 /
57
-BEGIN map2users('ACTIVE_WATCHERS'); END;
54
+BEGIN map2users('active_watchers'); END;
58 55
 /
59
-
60
-INSERT INTO VERSION (table_name,table_version) VALUES ('watchers',3);
61
-create table WATCHERS
62
-(
63
-  ID               NUMBER(10) not null,
64
-  PRESENTITY_URI   VARCHAR2(128) not null,
65
-  WATCHER_USERNAME VARCHAR2(64) not null,
66
-  WATCHER_DOMAIN   VARCHAR2(64) not null,
67
-  EVENT            VARCHAR2(64) default 'presence',
68
-  STATUS           NUMBER(10) not null,
69
-  REASON           VARCHAR2(64),
70
-  INSERTED_TIME    NUMBER(10) not null
56
+INSERT INTO version (table_name, table_version) values ('watchers','3');
57
+CREATE TABLE watchers (
58
+    id NUMBER(10) PRIMARY KEY,
59
+    presentity_uri VARCHAR2(128),
60
+    watcher_username VARCHAR2(64),
61
+    watcher_domain VARCHAR2(64),
62
+    event VARCHAR2(64) DEFAULT 'presence',
63
+    status NUMBER(10),
64
+    reason VARCHAR2(64),
65
+    inserted_time NUMBER(10),
66
+    CONSTRAINT watchers_watcher_idx  UNIQUE (presentity_uri, watcher_username, watcher_domain, event)
71 67
 );
72
-alter table WATCHERS add constraint PK_WATCHERS primary key (ID);
73
-alter table WATCHERS add constraint WATCHER_IDX unique (PRESENTITY_URI,WATCHER_USERNAME,WATCHER_DOMAIN,EVENT);
74
-create or replace trigger watchers_tr
68
+
69
+CREATE OR REPLACE TRIGGER watchers_tr
75 70
 before insert on watchers FOR EACH ROW
76 71
 BEGIN
77 72
   auto_id(:NEW.id);
78 73
 END watchers_tr;
79 74
 /
80
-BEGIN map2users('WATCHERS'); END;
75
+BEGIN map2users('watchers'); END;
81 76
 /
82
-
83
-INSERT INTO VERSION (table_name,table_version) VALUES ('xcap',3);
84
-create table XCAP
85
-(
86
-  ID       NUMBER(10) not null,
87
-  USERNAME VARCHAR2(64) not null,
88
-  DOMAIN   VARCHAR2(64) not null,
89
-  DOC_TYPE NUMBER(10) not null,
90
-  ETAG     VARCHAR2(64) not null,
91
-  SOURCE   NUMBER(10) not null,
92
-  DOC_URI  VARCHAR2(128) not null,
93
-  PORT     NUMBER(10) not null,
94
-  DOC      VARCHAR2(4000) not null
77
+INSERT INTO version (table_name, table_version) values ('xcap','3');
78
+CREATE TABLE xcap (
79
+    id NUMBER(10) PRIMARY KEY,
80
+    username VARCHAR2(64),
81
+    domain VARCHAR2(64),
82
+    doc BLOB,
83
+    doc_type NUMBER(10),
84
+    etag VARCHAR2(64),
85
+    source NUMBER(10),
86
+    doc_uri VARCHAR2(128),
87
+    port NUMBER(10),
88
+    CONSTRAINT xcap_account_doc_type_idx  UNIQUE (username, domain, doc_type, doc_uri)
95 89
 );
96
-alter table XCAP add constraint PK_XCAP primary key (ID);
97
-alter table XCAP add constraint XCAP_ACCOUNT_DOC_TYPE_IDX unique (USERNAME,DOMAIN,DOC_TYPE,DOC_URI);
98
-create index XCAP_SOURCE_IDX on XCAP (SOURCE);
99
-create or replace trigger xcap_tr
90
+
91
+CREATE OR REPLACE TRIGGER xcap_tr
100 92
 before insert on xcap FOR EACH ROW
101 93
 BEGIN
102 94
   auto_id(:NEW.id);
103 95
 END xcap_tr;
104 96
 /
105
-BEGIN map2users('XCAP'); END;
97
+BEGIN map2users('xcap'); END;
106 98
 /
99
+CREATE INDEX xcap_source_idx  ON xcap (source);
107 100
 
108
-INSERT INTO VERSION (table_name,table_version) VALUES ('pua',5);
109
-create table PUA
110
-(
111
-  ID              NUMBER(10) not null,
112
-  PRES_URI        VARCHAR2(128) not null,
113
-  PRES_ID         VARCHAR2(64) not null,
114
-  EVENT           NUMBER(10) not null,
115
-  EXPIRES         NUMBER(10) not null,
116
-  DESIRED_EXPIRES NUMBER(10) not null,
117
-  FLAG            NUMBER(10) not null,
118
-  ETAG            VARCHAR2(64) not null,
119
-  TUPLE_ID        VARCHAR2(64),
120
-  WATCHER_URI     VARCHAR2(128) not null,
121
-  CALL_ID         VARCHAR2(64) not null,
122
-  TO_TAG          VARCHAR2(64) not null,
123
-  FROM_TAG        VARCHAR2(64) not null,
124
-  CSEQ            NUMBER(10) not null,
125
-  RECORD_ROUTE    VARCHAR2(1000),
126
-  CONTACT         VARCHAR2(128) not null,
127
-  VERSION         NUMBER(10) not null,
128
-  EXTRA_HEADERS   VARCHAR2(1000) not null
101
+INSERT INTO version (table_name, table_version) values ('pua','5');
102
+CREATE TABLE pua (
103
+    id NUMBER(10) PRIMARY KEY,
104
+    pres_uri VARCHAR2(128),
105
+    pres_id VARCHAR2(64),
106
+    event NUMBER(10),
107
+    expires NUMBER(10),
108
+    desired_expires NUMBER(10),
109
+    flag NUMBER(10),
110
+    etag VARCHAR2(64),
111
+    tuple_id VARCHAR2(64),
112
+    watcher_uri VARCHAR2(128),
113
+    call_id VARCHAR2(64),
114
+    to_tag VARCHAR2(64),
115
+    from_tag VARCHAR2(64),
116
+    cseq NUMBER(10),
117
+    record_route CLOB,
118
+    contact VARCHAR2(128),
119
+    version NUMBER(10),
120
+    extra_headers CLOB
129 121
 );
130
-alter table PUA add constraint PK_PUA primary key (ID);
131
-create or replace trigger pua_tr
122
+
123
+CREATE OR REPLACE TRIGGER pua_tr
132 124
 before insert on pua FOR EACH ROW
133 125
 BEGIN
134 126
   auto_id(:NEW.id);
135 127
 END pua_tr;
136 128
 /
137
-BEGIN map2users('PUA'); END;
129
+BEGIN map2users('pua'); END;
138 130
 /
... ...
@@ -1,30 +1,30 @@
1
-INSERT INTO VERSION (table_name,table_version) values ('aliases',1004);
2
-create table ALIASES
3
-(
4
-  ID            NUMBER(10) not null,
5
-  USERNAME      VARCHAR2(64) default '',
6
-  DOMAIN        VARCHAR2(64) default null,
7
-  CONTACT       VARCHAR2(255) default '',
8
-  RECEIVED      VARCHAR2(128) default null,
9
-  PATH          VARCHAR2(128) default null,
10
-  EXPIRES       DATE default to_date('28-FEB-2020 21:32:15','dd-mm-yyyy hh24:mi:ss'),
11
-  Q             NUMBER(10,2) default 1,
12
-  CALLID        VARCHAR2(255) default 'Default-Call-ID',
13
-  CSEQ          NUMBER(10) default 13,
14
-  LAST_MODIFIED DATE default to_date('01-JAN-1900 00:00:01','dd-mm-yyyy hh24:mi:ss'),
15
-  FLAGS         NUMBER(11) default 0,
16
-  CFLAGS        NUMBER(11) default 0,
17
-  USER_AGENT    VARCHAR2(255) default '',
18
-  SOCKET        VARCHAR2(64) default null,
19
-  METHODS       NUMBER(10) default null
1
+INSERT INTO version (table_name, table_version) values ('aliases','1004');
2
+CREATE TABLE aliases (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    username VARCHAR2(64) DEFAULT '',
5
+    domain VARCHAR2(64) DEFAULT NULL,
6
+    contact VARCHAR2(255) DEFAULT '',
7
+    received VARCHAR2(128) DEFAULT NULL,
8
+    path VARCHAR2(128) DEFAULT NULL,
9
+    expires DATE DEFAULT to_date('2020-05-28 21:32:15','yyyy-mm-dd hh24:mi:ss'),
10
+    q NUMBER(10,2) DEFAULT 1.0 NOT NULL,
11
+    callid VARCHAR2(255) DEFAULT 'Default-Call-ID',
12
+    cseq NUMBER(10) DEFAULT 13 NOT NULL,
13
+    last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'),
14
+    flags NUMBER(10) DEFAULT 0 NOT NULL,
15
+    cflags NUMBER(10) DEFAULT 0 NOT NULL,
16
+    user_agent VARCHAR2(255) DEFAULT '',
17
+    socket VARCHAR2(64) DEFAULT NULL,
18
+    methods NUMBER(10) DEFAULT NULL
20 19
 );
21
-alter table ALIASES add constraint PK_ALIASES primary key (ID);
22
-create index ALIASES_ALIAS_IDX on ALIASES (USERNAME,DOMAIN,CONTACT);
23
-create or replace trigger aliases_tr
20
+
21
+CREATE OR REPLACE TRIGGER aliases_tr
24 22
 before insert on aliases FOR EACH ROW
25 23
 BEGIN
26 24
   auto_id(:NEW.id);
27 25
 END aliases_tr;
28 26
 /
29
-BEGIN map2users('ALIASES'); END;
27
+BEGIN map2users('aliases'); END;
30 28
 /
29
+CREATE INDEX aliases_alias_idx  ON aliases (username, domain, contact);
30
+
... ...
@@ -1,60 +1,58 @@
1
-INSERT INTO VERSION (table_name,table_version) VALUES ('rls_presentity',0);
2
-create table RLS_PRESENTITY
3
-(
4
-  ID             NUMBER(10) not null,
5
-  RLSUBS_DID     VARCHAR2(512) not null,
6
-  RESOURCE_URI   VARCHAR2(128) not null,
7
-  CONTENT_TYPE   VARCHAR2(64) not null,
8
-  EXPIRES        NUMBER(10) not null,
9
-  UPDATED        NUMBER(10) not null,
10
-  AUTH_STATE     NUMBER(10) not null,
11
-  REASON         VARCHAR2(64) not null,
12
-  PRESENCE_STATE VARCHAR2(4000) not null
1
+INSERT INTO version (table_name, table_version) values ('rls_presentity','0');
2
+CREATE TABLE rls_presentity (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    rlsubs_did VARCHAR2(512),
5
+    resource_uri VARCHAR2(128),
6
+    content_type VARCHAR2(64),
7
+    presence_state BLOB,
8
+    expires NUMBER(10),
9
+    updated NUMBER(10),
10
+    auth_state NUMBER(10),
11
+    reason VARCHAR2(64),
12
+    CONSTRAINT ORA_rls_presentity_idx  UNIQUE (rlsubs_did, resource_uri)
13 13
 );
14
-alter table RLS_PRESENTITY add constraint PK_RLS_PRESENTITY primary key (ID);
15
-alter table RLS_PRESENTITY add constraint RLS_PRESENTITY_IDX unique (RLSUBS_DID,RESOURCE_URI);
16
-create index RLS_PRESENTITY_UPDATED_IDX ON RLS_PRESENTITY (UPDATED);
17
-create or replace trigger rls_presentity_tr
14
+
15
+CREATE OR REPLACE TRIGGER rls_presentity_tr
18 16
 before insert on rls_presentity FOR EACH ROW
19 17
 BEGIN
20 18
   auto_id(:NEW.id);
21 19
 END rls_presentity_tr;
22 20
 /
23
-BEGIN map2users('RLS_PRESENTITY'); END;
21
+BEGIN map2users('rls_presentity'); END;
24 22
 /
23
+CREATE INDEX rls_presentity_updated_idx  ON rls_presentity (updated);
25 24
 
26
-INSERT INTO VERSION (table_name,table_version) VALUES ('rls_watchers',1);
27
-CREATE table RLS_WATCHERS
28
-(
29
-  ID               NUMBER(10) not null,
30
-  PRESENTITY_URI   VARCHAR2(128) not null,
31
-  TO_USER          VARCHAR2(64) not null,
32
-  TO_DOMAIN        VARCHAR2(64) not null,
33
-  WATCHER_USERNAME VARCHAR2(64) not null,
34
-  WATCHER_DOMAIN   VARCHAR2(64) not null,
35
-  EVENT            VARCHAR2(64) default 'presence',
36
-  EVENT_ID         VARCHAR2(64),
37
-  TO_TAG           VARCHAR2(64) not null,
38
-  FROM_TAG         VARCHAR2(64) not null,
39
-  CALLID           VARCHAR2(64) not null,
40
-  LOCAL_CSEQ       NUMBER(10) not null,
41
-  REMOTE_CSEQ      NUMBER(10) not null,
42
-  CONTACT          VARCHAR2(64) not null,
43
-  RECORD_ROUTE     VARCHAR2(1000),
44
-  EXPIRES          NUMBER(10) not null,
45
-  STATUS           NUMBER(10) default 2,
46
-  REASON           VARCHAR2(64) not null,
47
-  VERSION          NUMBER(10) default 0,
48
-  SOCKET_INFO      VARCHAR2(64) not null,
49
-  LOCAL_CONTACT    VARCHAR2(128) not null
25
+INSERT INTO version (table_name, table_version) values ('rls_watchers','1');
26
+CREATE TABLE rls_watchers (
27
+    id NUMBER(10) PRIMARY KEY,
28
+    presentity_uri VARCHAR2(128),
29
+    to_user VARCHAR2(64),
30
+    to_domain VARCHAR2(64),
31
+    watcher_username VARCHAR2(64),
32
+    watcher_domain VARCHAR2(64),
33
+    event VARCHAR2(64) DEFAULT 'presence',
34
+    event_id VARCHAR2(64),
35
+    to_tag VARCHAR2(64),
36
+    from_tag VARCHAR2(64),
37
+    callid VARCHAR2(64),
38
+    local_cseq NUMBER(10),
39
+    remote_cseq NUMBER(10),
40
+    contact VARCHAR2(64),
41
+    record_route CLOB,
42
+    expires NUMBER(10),
43
+    status NUMBER(10) DEFAULT 2 NOT NULL,
44
+    reason VARCHAR2(64),
45
+    version NUMBER(10) DEFAULT 0 NOT NULL,
46
+    socket_info VARCHAR2(64),
47
+    local_contact VARCHAR2(128),
48
+    CONSTRAINT rls_watchers_rls_watcher_idx  UNIQUE (presentity_uri, callid, to_tag, from_tag)
50 49
 );
51
-alter table RLS_WATCHERS add constraint PK_RLS_WATCHERS primary key (ID);
52
-alter table RLS_WATCHERS add constraint RLS_WATCHERS_RLS_WATCHER_IDX unique (PRESENTITY_URI,CALLID,TO_TAG,FROM_TAG);
53
-create or replace trigger rls_watchers_tr
50
+
51
+CREATE OR REPLACE TRIGGER rls_watchers_tr
54 52
 before insert on rls_watchers FOR EACH ROW
55 53
 BEGIN
56 54
   auto_id(:NEW.id);
57 55
 END rls_watchers_tr;
58 56
 /
59
-BEGIN map2users('RLS_WATCHERS'); END;
57
+BEGIN map2users('rls_watchers'); END;
60 58
 /
... ...
@@ -1,28 +1,28 @@
1
-INSERT INTO VERSION (table_name,table_version) VALUES ('sip_trace',2);
2
-create table SIP_TRACE
3
-(
4
-  ID          NUMBER(10) not null,
5
-  TIME_STAMP  DATE default to_date('01-JAN-1900 00:00:01','dd-mm-yyyy hh24:mi:ss'),
6
-  CALLID      VARCHAR2(255) default '',
7
-  TRACED_USER VARCHAR2(128) default '',
8
-  MSG         VARCHAR2(1000) not null,
9
-  METHOD      VARCHAR2(50) default '',
10
-  STATUS      VARCHAR2(128) default '',
11
-  FROMIP      VARCHAR2(50) default '',
12
-  TOIP        VARCHAR2(50) default '',
13
-  FROMTAG     VARCHAR2(64) default '',
14
-  DIRECTION   VARCHAR2(4) default ''
1
+INSERT INTO version (table_name, table_version) values ('sip_trace','2');
2
+CREATE TABLE sip_trace (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    time_stamp DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'),
5
+    callid VARCHAR2(255) DEFAULT '',
6
+    traced_user VARCHAR2(128) DEFAULT '',
7
+    msg CLOB,
8
+    method VARCHAR2(50) DEFAULT '',
9
+    status VARCHAR2(128) DEFAULT '',
10
+    fromip VARCHAR2(50) DEFAULT '',
11
+    toip VARCHAR2(50) DEFAULT '',
12
+    fromtag VARCHAR2(64) DEFAULT '',
13
+    direction VARCHAR2(4) DEFAULT ''
15 14
 );
16
-alter table SIP_TRACE add constraint PK_SIP_TRACE primary key (ID);
17
-create index SIP_TRACE_CALLID_IDX on SIP_TRACE (CALLID);
18
-create index SIP_TRACE_DATE_IDX on SIP_TRACE (TIME_STAMP);
19
-create index SIP_TRACE_FROMIP_IDX on SIP_TRACE (FROMIP);
20
-create index SIP_TRACE_TRACED_USER_IDX on SIP_TRACE (TRACED_USER);
21
-create or replace trigger sip_trace_tr
15
+
16
+CREATE OR REPLACE TRIGGER sip_trace_tr
22 17
 before insert on sip_trace FOR EACH ROW
23 18
 BEGIN
24 19
   auto_id(:NEW.id);
25 20
 END sip_trace_tr;
26 21
 /
27
-BEGIN map2users('SIP_TRACE'); END;
22
+BEGIN map2users('sip_trace'); END;
28 23
 /
24
+CREATE INDEX sip_trace_traced_user_idx  ON sip_trace (traced_user);
25
+CREATE INDEX sip_trace_date_idx  ON sip_trace (time_stamp);
26
+CREATE INDEX sip_trace_fromip_idx  ON sip_trace (fromip);
27
+CREATE INDEX sip_trace_callid_idx  ON sip_trace (callid);
28
+
... ...
@@ -1,23 +1,22 @@
1
-INSERT INTO VERSION (table_name,table_version) VALUES ('speed_dial',1);
2
-create table SPEED_DIAL
3
-(
4
-  ID          NUMBER(10) not null,
5
-  USERNAME    VARCHAR2(64) default '',
6
-  DOMAIN      VARCHAR2(64) default '',
7
-  SD_USERNAME VARCHAR2(64) default '',
8
-  SD_DOMAIN   VARCHAR2(64) default '',
9
-  NEW_URI     VARCHAR2(128) default '',
10
-  FNAME       VARCHAR2(64) default '',
11
-  LNAME       VARCHAR2(64) default '',
12
-  DESCRIPTION VARCHAR2(64) default ''
1
+INSERT INTO version (table_name, table_version) values ('speed_dial','2');
2
+CREATE TABLE speed_dial (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    username VARCHAR2(64) DEFAULT '',
5
+    domain VARCHAR2(64) DEFAULT '',
6
+    sd_username VARCHAR2(64) DEFAULT '',
7
+    sd_domain VARCHAR2(64) DEFAULT '',
8
+    new_uri VARCHAR2(128) DEFAULT '',
9
+    fname VARCHAR2(64) DEFAULT '',
10
+    lname VARCHAR2(64) DEFAULT '',
11
+    description VARCHAR2(64) DEFAULT '',
12
+    CONSTRAINT speed_dial_speed_dial_idx  UNIQUE (username, domain, sd_domain, sd_username)
13 13
 );
14
-alter table SPEED_DIAL add constraint PK_SPEED_DIAL primary key (ID);
15
-alter table SPEED_DIAL add constraint SPEED_DIAL_IDX unique (USERNAME,DOMAIN,SD_DOMAIN,SD_USERNAME);
16
-create or replace trigger speed_dial_tr
14
+
15
+CREATE OR REPLACE TRIGGER speed_dial_tr
17 16
 before insert on speed_dial FOR EACH ROW
18 17
 BEGIN
19 18
   auto_id(:NEW.id);
20 19
 END speed_dial_tr;
21 20
 /
22
-BEGIN map2users('SPEED_DIAL'); END;
21
+BEGIN map2users('speed_dial'); END;
23 22
 /
... ...
@@ -1,7 +1,7 @@
1
-create table VERSION
2
-(
3
-  TABLE_NAME    VARCHAR2(32) not null,
4
-  TABLE_VERSION NUMBER(10) default 0
1
+CREATE TABLE version (
2
+    table_name VARCHAR2(32),
3
+    table_version NUMBER(10) DEFAULT 0 NOT NULL
5 4
 );
6
-BEGIN map2users('VERSION'); END;
5
+
6
+BEGIN map2users('version'); END;
7 7
 /
... ...
@@ -1,19 +1,18 @@
1
-INSERT INTO VERSION (table_name,table_version) VALUES ('uri',1);
2
-create table URI
3
-(
4
-  ID            NUMBER(10) not null,
5
-  USERNAME      VARCHAR2(64) default '',
6
-  DOMAIN        VARCHAR2(64) default '',
7
-  URI_USER      VARCHAR2(64) default '',
8
-  LAST_MODIFIED DATE default to_date('01-JAN-1900 00:00:01','dd-mm-yyyy hh24:mi:ss')
1
+INSERT INTO version (table_name, table_version) values ('uri','1');
2
+CREATE TABLE uri (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    username VARCHAR2(64) DEFAULT '',
5
+    domain VARCHAR2(64) DEFAULT '',
6
+    uri_user VARCHAR2(64) DEFAULT '',
7
+    last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'),
8
+    CONSTRAINT uri_account_idx  UNIQUE (username, domain, uri_user)
9 9
 );
10
-alter table URI add constraint PK_URI primary key (ID);
11
-alter table URI add constraint URI_ACCOUNT_IDX unique (USERNAME,DOMAIN,URI_USER);
12
-create or replace trigger uri_tr
10
+
11
+CREATE OR REPLACE TRIGGER uri_tr
13 12
 before insert on uri FOR EACH ROW
14 13
 BEGIN
15 14
   auto_id(:NEW.id);
16
-end uri_tr;
15
+END uri_tr;
17 16
 /
18
-BEGIN map2users('URI'); END;
17
+BEGIN map2users('uri'); END;
19 18
 /
... ...
@@ -1,39 +1,38 @@
1
-INSERT INTO VERSION (table_name,table_version) VALUES ('userblacklist',1);
2
-CREATE TABLE USERBLACKLIST
3
-(
4
-  ID          NUMBER(10) not null,
5
-  USERNAME    VARCHAR2(64) default '',
6
-  DOMAIN      VARCHAR2(64) default '',
7
-  PREFIX      VARCHAR2(64) default '',
8
-  WHITELIST   NUMBER(1) default 0,
9
-  DESCRIPTION VARCHAR2(64) default ''
1
+INSERT INTO version (table_name, table_version) values ('userblacklist','1');
2
+CREATE TABLE userblacklist (
3
+    id NUMBER(10) PRIMARY KEY,
4
+    username VARCHAR2(64) DEFAULT '',
5
+    domain VARCHAR2(64) DEFAULT '',
6
+    prefix VARCHAR2(64) DEFAULT '',
7
+    whitelist NUMBER(10) DEFAULT 0 NOT NULL,
8
+    description VARCHAR2(64) DEFAULT ''
10 9
 );
11
-alter table USERBLACKLIST add constraint PK_USERBLACKLIST primary key (ID);
12
-create index USERBLACKLIST_IDX on USERBLACKLIST (USERNAME,DOMAIN,PREFIX);
13
-create or replace trigger userblacklist_tr
10
+
11
+CREATE OR REPLACE TRIGGER userblacklist_tr
14 12
 before insert on userblacklist FOR EACH ROW
15 13
 BEGIN
16 14
   auto_id(:NEW.id);
17 15
 END userblacklist_tr;
18 16
 /
19
-BEGIN map2users('USERBLACKLIST'); END;
17
+BEGIN map2users('userblacklist'); END;
20 18
 /
19
+CREATE INDEX ORA_userblacklist_idx  ON userblacklist (username, domain, prefix);
21 20
 
22
-INSERT INTO VERSION (table_name,table_version) VALUES ('globalblacklist',1);
23
-CREATE TABLE GLOBALBLACKLIST
24
-(
25
-  ID          NUMBER(10) not null,
26
-  PREFIX      VARCHAR2(64) default '',
27
-  WHITELIST   NUMBER(1) default 0,
28
-  DESCRIPTION VARCHAR2(64) default ''
21
+INSERT INTO version (table_name, table_version) values ('globalblacklist','1');
22
+CREATE TABLE globalblacklist (
23
+    id NUMBER(10) PRIMARY KEY,
24
+    prefix VARCHAR2(64) DEFAULT '',
25
+    whitelist NUMBER(10) DEFAULT 0 NOT NULL,
26
+    description VARCHAR2(64) DEFAULT ''
29 27
 );
30
-alter table GLOBALBLACKLIST add constraint PK_GLOBALBLACKLIST primary key (ID);
31
-create index GLOBALBLACKLIST_USRBLCKLST_IDX on GLOBALBLACKLIST (PREFIX);
32
-create or replace trigger globalblacklist_tr
28
+
29
+CREATE OR REPLACE TRIGGER globalblacklist_tr
33 30
 before insert on globalblacklist FOR EACH ROW
34 31
 BEGIN
35 32
   auto_id(:NEW.id);
36 33
 END globalblacklist_tr;
37 34
 /
38
-BEGIN map2users('GLOBALBLACKLIST'); END;
35
+BEGIN map2users('globalblacklist'); END;
39 36
 /
37
+CREATE INDEX ORA_globalblacklist_idx  ON globalblacklist (prefix);
38
+
... ...
@@ -1,30 +1,30 @@
1