Module: sip-router Branch: master Commit: ec21c13b86139f10d2280fe75a7ba15f3e30a83a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ec21c13b...
Author: Timo Reimann timo.reimann@1und1.de Committer: Timo Reimann timo.reimann@1und1.de Date: Tue Aug 16 20:33:06 2011 +0200
utils: Add database creation scripts for dialog variable table (dialog_vars).
---
utils/kamctl/db_berkeley/kamailio/dialog_vars | 10 ++++++++++ utils/kamctl/db_sqlite/dialog-vars-create.sql | 11 +++++++++++ utils/kamctl/dbtext/kamailio/dialog_vars | 1 + utils/kamctl/mysql/dialog-vars-create.sql | 11 +++++++++++ utils/kamctl/oracle/dialog-vars-create.sql | 19 +++++++++++++++++++ utils/kamctl/postgres/dialog-vars-create.sql | 11 +++++++++++ 6 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/utils/kamctl/db_berkeley/kamailio/dialog_vars b/utils/kamctl/db_berkeley/kamailio/dialog_vars new file mode 100644 index 0000000..1b66d4e --- /dev/null +++ b/utils/kamctl/db_berkeley/kamailio/dialog_vars @@ -0,0 +1,10 @@ +METADATA_COLUMNS +id(int) hash_entry(int) hash_id(int) dialog_key(str) dialog_value(str) +METADATA_KEY +1 2 +METADATA_READONLY +0 +METADATA_LOGFLAGS +0 +METADATA_DEFAULTS +NIL|NIL|NIL|NIL|NIL diff --git a/utils/kamctl/db_sqlite/dialog-vars-create.sql b/utils/kamctl/db_sqlite/dialog-vars-create.sql new file mode 100644 index 0000000..860a87d --- /dev/null +++ b/utils/kamctl/db_sqlite/dialog-vars-create.sql @@ -0,0 +1,11 @@ +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); +CREATE TABLE dialog_vars ( + id INTEGER PRIMARY KEY NOT NULL, + hash_entry INTEGER NOT NULL, + hash_id INTEGER NOT NULL, + dialog_key VARCHAR(128) NOT NULL, + dialog_value VARCHAR(512) NOT NULL +) ENGINE=MyISAM; + +CREATE INDEX hash_idx ON dialog_vars (hash_entry, hash_id); + diff --git a/utils/kamctl/dbtext/kamailio/dialog_vars b/utils/kamctl/dbtext/kamailio/dialog_vars new file mode 100644 index 0000000..d39ef42 --- /dev/null +++ b/utils/kamctl/dbtext/kamailio/dialog_vars @@ -0,0 +1 @@ +id(int,auto) hash_entry(int) hash_id(int) dialog_key(string) dialog_value(string) diff --git a/utils/kamctl/mysql/dialog-vars-create.sql b/utils/kamctl/mysql/dialog-vars-create.sql new file mode 100644 index 0000000..c8787e6 --- /dev/null +++ b/utils/kamctl/mysql/dialog-vars-create.sql @@ -0,0 +1,11 @@ +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); +CREATE TABLE dialog_vars ( + id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, + hash_entry INT(10) UNSIGNED NOT NULL, + hash_id INT(10) UNSIGNED NOT NULL, + dialog_key VARCHAR(128) NOT NULL, + dialog_value VARCHAR(512) NOT NULL +) ENGINE=MyISAM; + +CREATE INDEX hash_idx ON dialog_vars (hash_entry, hash_id); + diff --git a/utils/kamctl/oracle/dialog-vars-create.sql b/utils/kamctl/oracle/dialog-vars-create.sql new file mode 100644 index 0000000..9dbaea7 --- /dev/null +++ b/utils/kamctl/oracle/dialog-vars-create.sql @@ -0,0 +1,19 @@ +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); +CREATE TABLE dialog_vars ( + id NUMBER(10) PRIMARY KEY, + hash_entry NUMBER(10), + hash_id NUMBER(10), + dialog_key VARCHAR2(128), + dialog_value VARCHAR2(512) +); + +CREATE OR REPLACE TRIGGER dialog_vars_tr +before insert on dialog_vars FOR EACH ROW +BEGIN + auto_id(:NEW.id); +END dialog_vars_tr; +/ +BEGIN map2users('dialog_vars'); END; +/ +CREATE INDEX dialog_vars_hash_idx ON dialog_vars (hash_entry, hash_id); + diff --git a/utils/kamctl/postgres/dialog-vars-create.sql b/utils/kamctl/postgres/dialog-vars-create.sql new file mode 100644 index 0000000..ccc7d68 --- /dev/null +++ b/utils/kamctl/postgres/dialog-vars-create.sql @@ -0,0 +1,11 @@ +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); +CREATE TABLE dialog_vars ( + id SERIAL PRIMARY KEY NOT NULL, + hash_entry INTEGER NOT NULL, + hash_id INTEGER NOT NULL, + dialog_key VARCHAR(128) NOT NULL, + dialog_value VARCHAR(512) +); + +CREATE INDEX dialog_vars_hash_idx ON dialog_vars (hash_entry, hash_id); +
Hi Timo,
do you have also the xml schema for the definition of dialog_vars table? The table creation scripts are generated from xml spec files located in lib/srdb1/schema/, but i do not see the one for dialog_vars.
Also, the sql creation scripts followed the pattern: tablename-create.sql, in this case it is dialog-vars-create.sql instead of dialog_vars-create.sql -- this should be easy to fix with:
git mv oldfile newfile ...
Keeping the same pattern for these scripts is important for kamdbctl.
Cheers, Daniel
On 8/16/11 8:33 PM, Timo Reimann wrote:
Module: sip-router Branch: master Commit: ec21c13b86139f10d2280fe75a7ba15f3e30a83a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ec21c13b...
Author: Timo Reimanntimo.reimann@1und1.de Committer: Timo Reimanntimo.reimann@1und1.de Date: Tue Aug 16 20:33:06 2011 +0200
utils: Add database creation scripts for dialog variable table (dialog_vars).
utils/kamctl/db_berkeley/kamailio/dialog_vars | 10 ++++++++++ utils/kamctl/db_sqlite/dialog-vars-create.sql | 11 +++++++++++ utils/kamctl/dbtext/kamailio/dialog_vars | 1 + utils/kamctl/mysql/dialog-vars-create.sql | 11 +++++++++++ utils/kamctl/oracle/dialog-vars-create.sql | 19 +++++++++++++++++++ utils/kamctl/postgres/dialog-vars-create.sql | 11 +++++++++++ 6 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/utils/kamctl/db_berkeley/kamailio/dialog_vars b/utils/kamctl/db_berkeley/kamailio/dialog_vars new file mode 100644 index 0000000..1b66d4e --- /dev/null +++ b/utils/kamctl/db_berkeley/kamailio/dialog_vars @@ -0,0 +1,10 @@ +METADATA_COLUMNS +id(int) hash_entry(int) hash_id(int) dialog_key(str) dialog_value(str) +METADATA_KEY +1 2 +METADATA_READONLY +0 +METADATA_LOGFLAGS +0 +METADATA_DEFAULTS +NIL|NIL|NIL|NIL|NIL diff --git a/utils/kamctl/db_sqlite/dialog-vars-create.sql b/utils/kamctl/db_sqlite/dialog-vars-create.sql new file mode 100644 index 0000000..860a87d --- /dev/null +++ b/utils/kamctl/db_sqlite/dialog-vars-create.sql @@ -0,0 +1,11 @@ +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); +CREATE TABLE dialog_vars (
- id INTEGER PRIMARY KEY NOT NULL,
- hash_entry INTEGER NOT NULL,
- hash_id INTEGER NOT NULL,
- dialog_key VARCHAR(128) NOT NULL,
- dialog_value VARCHAR(512) NOT NULL
+) ENGINE=MyISAM;
+CREATE INDEX hash_idx ON dialog_vars (hash_entry, hash_id);
diff --git a/utils/kamctl/dbtext/kamailio/dialog_vars b/utils/kamctl/dbtext/kamailio/dialog_vars new file mode 100644 index 0000000..d39ef42 --- /dev/null +++ b/utils/kamctl/dbtext/kamailio/dialog_vars @@ -0,0 +1 @@ +id(int,auto) hash_entry(int) hash_id(int) dialog_key(string) dialog_value(string) diff --git a/utils/kamctl/mysql/dialog-vars-create.sql b/utils/kamctl/mysql/dialog-vars-create.sql new file mode 100644 index 0000000..c8787e6 --- /dev/null +++ b/utils/kamctl/mysql/dialog-vars-create.sql @@ -0,0 +1,11 @@ +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); +CREATE TABLE dialog_vars (
- id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
- hash_entry INT(10) UNSIGNED NOT NULL,
- hash_id INT(10) UNSIGNED NOT NULL,
- dialog_key VARCHAR(128) NOT NULL,
- dialog_value VARCHAR(512) NOT NULL
+) ENGINE=MyISAM;
+CREATE INDEX hash_idx ON dialog_vars (hash_entry, hash_id);
diff --git a/utils/kamctl/oracle/dialog-vars-create.sql b/utils/kamctl/oracle/dialog-vars-create.sql new file mode 100644 index 0000000..9dbaea7 --- /dev/null +++ b/utils/kamctl/oracle/dialog-vars-create.sql @@ -0,0 +1,19 @@ +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); +CREATE TABLE dialog_vars (
- id NUMBER(10) PRIMARY KEY,
- hash_entry NUMBER(10),
- hash_id NUMBER(10),
- dialog_key VARCHAR2(128),
- dialog_value VARCHAR2(512)
+);
+CREATE OR REPLACE TRIGGER dialog_vars_tr +before insert on dialog_vars FOR EACH ROW +BEGIN
- auto_id(:NEW.id);
+END dialog_vars_tr; +/ +BEGIN map2users('dialog_vars'); END; +/ +CREATE INDEX dialog_vars_hash_idx ON dialog_vars (hash_entry, hash_id);
diff --git a/utils/kamctl/postgres/dialog-vars-create.sql b/utils/kamctl/postgres/dialog-vars-create.sql new file mode 100644 index 0000000..ccc7d68 --- /dev/null +++ b/utils/kamctl/postgres/dialog-vars-create.sql @@ -0,0 +1,11 @@ +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); +CREATE TABLE dialog_vars (
- id SERIAL PRIMARY KEY NOT NULL,
- hash_entry INTEGER NOT NULL,
- hash_id INTEGER NOT NULL,
- dialog_key VARCHAR(128) NOT NULL,
- dialog_value VARCHAR(512)
+);
+CREATE INDEX dialog_vars_hash_idx ON dialog_vars (hash_entry, hash_id);
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Hey Daniel,
On 06.10.2011 23:26, Daniel-Constantin Mierla wrote:
do you have also the xml schema for the definition of dialog_vars table? The table creation scripts are generated from xml spec files located in lib/srdb1/schema/, but i do not see the one for dialog_vars.
I didn't know about the XML schema files; should be easy to create one for the dialog variables though. Will take care of that.
Also, the sql creation scripts followed the pattern: tablename-create.sql, in this case it is dialog-vars-create.sql instead of dialog_vars-create.sql -- this should be easy to fix with:
git mv oldfile newfile
Gotcha!
Thanks for the note and
cheers,
--Timo
Hi,
On 07.10.2011 10:24, Timo Reimann wrote:
On 06.10.2011 23:26, Daniel-Constantin Mierla wrote:
do you have also the xml schema for the definition of dialog_vars table? The table creation scripts are generated from xml spec files located in lib/srdb1/schema/, but i do not see the one for dialog_vars.
I didn't know about the XML schema files; should be easy to create one for the dialog variables though. Will take care of that.
Also, the sql creation scripts followed the pattern: tablename-create.sql, in this case it is dialog-vars-create.sql instead of dialog_vars-create.sql -- this should be easy to fix with:
git mv oldfile newfile
Gotcha!
Committed the desired changes. Let me know if there's still something wrong about it.
Cheers,
--Timo