Skip to content

Commit

Permalink
Updated DB schema to reflect the changes in the DR module (adding per…
Browse files Browse the repository at this point in the history
…sistency for carrier/gateway's state and sockets for gateways)
  • Loading branch information
bogdan-iancu committed Nov 24, 2013
1 parent a802488 commit 253704e
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 18 deletions.
11 changes: 10 additions & 1 deletion db/schema/dr_carriers.xml
Expand Up @@ -9,7 +9,7 @@

<table id="dr_carriers" xmlns:db="http://docbook.org/ns/docbook">
<name>dr_carriers</name>
<version>1</version>
<version>2</version>
<type db="mysql">&MYSQL_TABLE_TYPE;</type>
<description>
<db:para>This table is used by the Dynamic Routing module to define
Expand Down Expand Up @@ -54,6 +54,15 @@
</description>
</column>

<column id="state">
<name>state</name>
<type>unsigned int</type>
<size>&flag_len;</size>
<default>0</default>
<description>The state of the carrier (on / off).
</description>
</column>

<column id="attrs">
<name>attrs</name>
<type>string</type>
Expand Down
22 changes: 21 additions & 1 deletion db/schema/dr_gateways.xml
Expand Up @@ -9,7 +9,7 @@

<table id="dr_gateways" xmlns:db="http://docbook.org/ns/docbook">
<name>dr_gateways</name>
<version>5</version>
<version>6</version>
<type db="mysql">&MYSQL_TABLE_TYPE;</type>
<description>
<db:para>This table is used by the Dynamic Routing module to store
Expand Down Expand Up @@ -91,6 +91,26 @@
<description>0- No probing; 1-Probe on disable only ; 2-Always probe; </description>
</column>

<column>
<name>state</name>
<type>unsigned int</type>
<size>11</size>
<default>0</default>
<description>State of the gateway: 0 - enabled; 1 - permanent disabled;
2 - temporary disabled (probing)</description>
</column>

<column>
<name>socket</name>
<type>string</type>
<size>128</size>
<null/>
<default><null/></default>
<description>Local Socket to be used when sending requests (traffic and probes)
to the destination - must be an listener configured in opensips.
</description>
</column>

<column id="description">
<name>description</name>
<type>string</type>
Expand Down
4 changes: 2 additions & 2 deletions scripts/db_berkeley/opensips/dr_carriers
@@ -1,10 +1,10 @@
METADATA_COLUMNS
id(int) carrierid(str) gwlist(str) flags(int) attrs(str) description(str)
id(int) carrierid(str) gwlist(str) flags(int) state(int) attrs(str) description(str)
METADATA_KEY
0
METADATA_READONLY
0
METADATA_LOGFLAGS
0
METADATA_DEFAULTS
NIL|NIL|NIL|0|''|''
NIL|NIL|NIL|0|0|''|''
4 changes: 2 additions & 2 deletions scripts/db_berkeley/opensips/dr_gateways
@@ -1,10 +1,10 @@
METADATA_COLUMNS
id(int) gwid(str) type(int) address(str) strip(int) pri_prefix(str) attrs(str) probe_mode(int) description(str)
id(int) gwid(str) type(int) address(str) strip(int) pri_prefix(str) attrs(str) probe_mode(int) state(int) socket(str) description(str)
METADATA_KEY
0
METADATA_READONLY
0
METADATA_LOGFLAGS
0
METADATA_DEFAULTS
NIL|NIL|0|NIL|0|NULL|NULL|0|''
NIL|NIL|0|NIL|0|NULL|NULL|0|0|NULL|''
4 changes: 2 additions & 2 deletions scripts/db_berkeley/opensips/version
Expand Up @@ -43,9 +43,9 @@ domain|2
domainpolicy|
domainpolicy|3
dr_carriers|
dr_carriers|1
dr_carriers|2
dr_gateways|
dr_gateways|5
dr_gateways|6
dr_groups|
dr_groups|2
METADATA_DEFAULTS
Expand Down
2 changes: 1 addition & 1 deletion scripts/dbtext/opensips/dr_carriers
@@ -1 +1 @@
id(int,auto) carrierid(string) gwlist(string) flags(int) attrs(string,null) description(string)
id(int,auto) carrierid(string) gwlist(string) flags(int) state(int) attrs(string,null) description(string)
2 changes: 1 addition & 1 deletion scripts/dbtext/opensips/dr_gateways
@@ -1 +1 @@
id(int,auto) gwid(string) type(int) address(string) strip(int) pri_prefix(string,null) attrs(string,null) probe_mode(int) description(string)
id(int,auto) gwid(string) type(int) address(string) strip(int) pri_prefix(string,null) attrs(string,null) probe_mode(int) state(int) socket(string,null) description(string)
4 changes: 2 additions & 2 deletions scripts/dbtext/opensips/version
Expand Up @@ -16,8 +16,8 @@ dialplan:4
dispatcher:5
domain:2
domainpolicy:3
dr_carriers:1
dr_gateways:5
dr_carriers:2
dr_gateways:6
dr_groups:2
dr_rules:3
globalblacklist:2
Expand Down
7 changes: 5 additions & 2 deletions scripts/mysql/drouting-create.sql
@@ -1,4 +1,4 @@
INSERT INTO version (table_name, table_version) values ('dr_gateways','5');
INSERT INTO version (table_name, table_version) values ('dr_gateways','6');
CREATE TABLE dr_gateways (
id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
gwid CHAR(64) NOT NULL,
Expand All @@ -8,6 +8,8 @@ CREATE TABLE dr_gateways (
pri_prefix CHAR(16) DEFAULT NULL,
attrs CHAR(255) DEFAULT NULL,
probe_mode INT(11) UNSIGNED DEFAULT 0 NOT NULL,
state INT(11) UNSIGNED DEFAULT 0 NOT NULL,
socket CHAR(128) DEFAULT NULL,
description CHAR(128) DEFAULT '' NOT NULL,
CONSTRAINT dr_gw_idx UNIQUE (gwid)
) ENGINE=MyISAM;
Expand All @@ -25,12 +27,13 @@ CREATE TABLE dr_rules (
description CHAR(128) DEFAULT '' NOT NULL
) ENGINE=MyISAM;

INSERT INTO version (table_name, table_version) values ('dr_carriers','1');
INSERT INTO version (table_name, table_version) values ('dr_carriers','2');
CREATE TABLE dr_carriers (
id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
carrierid CHAR(64) NOT NULL,
gwlist CHAR(255) NOT NULL,
flags INT(11) UNSIGNED DEFAULT 0 NOT NULL,
state INT(11) UNSIGNED DEFAULT 0 NOT NULL,
attrs CHAR(255) DEFAULT '',
description CHAR(128) DEFAULT '' NOT NULL,
CONSTRAINT dr_carrier_idx UNIQUE (carrierid)
Expand Down
7 changes: 5 additions & 2 deletions scripts/oracle/drouting-create.sql
@@ -1,4 +1,4 @@
INSERT INTO version (table_name, table_version) values ('dr_gateways','5');
INSERT INTO version (table_name, table_version) values ('dr_gateways','6');
CREATE TABLE dr_gateways (
id NUMBER(10) PRIMARY KEY,
gwid VARCHAR2(64),
Expand All @@ -8,6 +8,8 @@ CREATE TABLE dr_gateways (
pri_prefix VARCHAR2(16) DEFAULT NULL,
attrs VARCHAR2(255) DEFAULT NULL,
probe_mode NUMBER(10) DEFAULT 0 NOT NULL,
state NUMBER(10) DEFAULT 0 NOT NULL,
socket VARCHAR2(128) DEFAULT NULL,
description VARCHAR2(128) DEFAULT '',
CONSTRAINT dr_gateways_dr_gw_idx UNIQUE (gwid)
);
Expand Down Expand Up @@ -41,12 +43,13 @@ END dr_rules_tr;
/
BEGIN map2users('dr_rules'); END;
/
INSERT INTO version (table_name, table_version) values ('dr_carriers','1');
INSERT INTO version (table_name, table_version) values ('dr_carriers','2');
CREATE TABLE dr_carriers (
id NUMBER(10) PRIMARY KEY,
carrierid VARCHAR2(64),
gwlist VARCHAR2(255),
flags NUMBER(10) DEFAULT 0 NOT NULL,
state NUMBER(10) DEFAULT 0 NOT NULL,
attrs VARCHAR2(255) DEFAULT '',
description VARCHAR2(128) DEFAULT '',
CONSTRAINT dr_carriers_dr_carrier_idx UNIQUE (carrierid)
Expand Down
9 changes: 9 additions & 0 deletions scripts/pi_http/drouting-mod
Expand Up @@ -12,6 +12,8 @@
<col><field>pri_prefix</field></col>
<col><field>attrs</field></col>
<col><field>probe_mode</field></col>
<col><field>state</field></col>
<col><field>socket</field></col>
<col><field>description</field></col>
</query_cols>
</cmd>
Expand All @@ -26,6 +28,8 @@
<col><field>pri_prefix</field></col>
<col><field>attrs</field></col>
<col><field>probe_mode</field></col>
<col><field>state</field></col>
<col><field>socket</field></col>
<col><field>description</field></col>
</query_cols>
</cmd>
Expand All @@ -43,6 +47,8 @@
<col><field>pri_prefix</field></col>
<col><field>attrs</field></col>
<col><field>probe_mode</field></col>
<col><field>state</field></col>
<col><field>socket</field></col>
<col><field>description</field></col>
</query_cols>
</cmd>
Expand Down Expand Up @@ -120,6 +126,7 @@
<col><field>carrierid</field></col>
<col><field>gwlist</field></col>
<col><field>flags</field></col>
<col><field>state</field></col>
<col><field>attrs</field></col>
<col><field>description</field></col>
</query_cols>
Expand All @@ -131,6 +138,7 @@
<col><field>carrierid</field></col>
<col><field>gwlist</field></col>
<col><field>flags</field></col>
<col><field>state</field></col>
<col><field>attrs</field></col>
<col><field>description</field></col>
</query_cols>
Expand All @@ -145,6 +153,7 @@
<col><field>carrierid</field></col>
<col><field>gwlist</field></col>
<col><field>flags</field></col>
<col><field>state</field></col>
<col><field>attrs</field></col>
<col><field>description</field></col>
</query_cols>
Expand Down
3 changes: 3 additions & 0 deletions scripts/pi_http/drouting-table
Expand Up @@ -10,6 +10,8 @@
<column><field>pri_prefix</field><type>DB_STR</type></column>
<column><field>attrs</field><type>DB_STR</type></column>
<column><field>probe_mode</field><type>DB_INT</type></column>
<column><field>state</field><type>DB_INT</type></column>
<column><field>socket</field><type>DB_STR</type></column>
<column><field>description</field><type>DB_STR</type></column>
</db_table>
<!-- Declaration of dr_rules table-->
Expand All @@ -34,6 +36,7 @@
<column><field>carrierid</field><type>DB_STR</type></column>
<column><field>gwlist</field><type>DB_STR</type></column>
<column><field>flags</field><type>DB_INT</type></column>
<column><field>state</field><type>DB_INT</type></column>
<column><field>attrs</field><type>DB_STR</type></column>
<column><field>description</field><type>DB_STR</type></column>
</db_table>
Expand Down
12 changes: 12 additions & 0 deletions scripts/pi_http/pi_framework.xml
Expand Up @@ -317,6 +317,8 @@
<column><field>pri_prefix</field><type>DB_STR</type></column>
<column><field>attrs</field><type>DB_STR</type></column>
<column><field>probe_mode</field><type>DB_INT</type></column>
<column><field>state</field><type>DB_INT</type></column>
<column><field>socket</field><type>DB_STR</type></column>
<column><field>description</field><type>DB_STR</type></column>
</db_table>
<!-- Declaration of dr_rules table-->
Expand All @@ -341,6 +343,7 @@
<column><field>carrierid</field><type>DB_STR</type></column>
<column><field>gwlist</field><type>DB_STR</type></column>
<column><field>flags</field><type>DB_INT</type></column>
<column><field>state</field><type>DB_INT</type></column>
<column><field>attrs</field><type>DB_STR</type></column>
<column><field>description</field><type>DB_STR</type></column>
</db_table>
Expand Down Expand Up @@ -1822,6 +1825,8 @@
<col><field>pri_prefix</field></col>
<col><field>attrs</field></col>
<col><field>probe_mode</field></col>
<col><field>state</field></col>
<col><field>socket</field></col>
<col><field>description</field></col>
</query_cols>
</cmd>
Expand All @@ -1836,6 +1841,8 @@
<col><field>pri_prefix</field></col>
<col><field>attrs</field></col>
<col><field>probe_mode</field></col>
<col><field>state</field></col>
<col><field>socket</field></col>
<col><field>description</field></col>
</query_cols>
</cmd>
Expand All @@ -1853,6 +1860,8 @@
<col><field>pri_prefix</field></col>
<col><field>attrs</field></col>
<col><field>probe_mode</field></col>
<col><field>state</field></col>
<col><field>socket</field></col>
<col><field>description</field></col>
</query_cols>
</cmd>
Expand Down Expand Up @@ -1930,6 +1939,7 @@
<col><field>carrierid</field></col>
<col><field>gwlist</field></col>
<col><field>flags</field></col>
<col><field>state</field></col>
<col><field>attrs</field></col>
<col><field>description</field></col>
</query_cols>
Expand All @@ -1941,6 +1951,7 @@
<col><field>carrierid</field></col>
<col><field>gwlist</field></col>
<col><field>flags</field></col>
<col><field>state</field></col>
<col><field>attrs</field></col>
<col><field>description</field></col>
</query_cols>
Expand All @@ -1955,6 +1966,7 @@
<col><field>carrierid</field></col>
<col><field>gwlist</field></col>
<col><field>flags</field></col>
<col><field>state</field></col>
<col><field>attrs</field></col>
<col><field>description</field></col>
</query_cols>
Expand Down
7 changes: 5 additions & 2 deletions scripts/postgres/drouting-create.sql
@@ -1,4 +1,4 @@
INSERT INTO version (table_name, table_version) values ('dr_gateways','5');
INSERT INTO version (table_name, table_version) values ('dr_gateways','6');
CREATE TABLE dr_gateways (
id SERIAL PRIMARY KEY NOT NULL,
gwid VARCHAR(64) NOT NULL,
Expand All @@ -8,6 +8,8 @@ CREATE TABLE dr_gateways (
pri_prefix VARCHAR(16) DEFAULT NULL,
attrs VARCHAR(255) DEFAULT NULL,
probe_mode INTEGER DEFAULT 0 NOT NULL,
state INTEGER DEFAULT 0 NOT NULL,
socket VARCHAR(128) DEFAULT NULL,
description VARCHAR(128) DEFAULT '' NOT NULL,
CONSTRAINT dr_gateways_dr_gw_idx UNIQUE (gwid)
);
Expand All @@ -25,12 +27,13 @@ CREATE TABLE dr_rules (
description VARCHAR(128) DEFAULT '' NOT NULL
);

INSERT INTO version (table_name, table_version) values ('dr_carriers','1');
INSERT INTO version (table_name, table_version) values ('dr_carriers','2');
CREATE TABLE dr_carriers (
id SERIAL PRIMARY KEY NOT NULL,
carrierid VARCHAR(64) NOT NULL,
gwlist VARCHAR(255) NOT NULL,
flags INTEGER DEFAULT 0 NOT NULL,
state INTEGER DEFAULT 0 NOT NULL,
attrs VARCHAR(255) DEFAULT '',
description VARCHAR(128) DEFAULT '' NOT NULL,
CONSTRAINT dr_carriers_dr_carrier_idx UNIQUE (carrierid)
Expand Down

0 comments on commit 253704e

Please sign in to comment.