Module: kamailio
Branch: master
Commit: 61eb1ac798ba3023fc51373a3fa824c70e0ece0c
URL:
https://github.com/kamailio/kamailio/commit/61eb1ac798ba3023fc51373a3fa824c…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-18T20:44:29+01:00
kamdbctl: warn that drop cmd will drop existing DB, ask for confirmation (GH #1858)
- warn that the drop command will drop existing DB, ask for confirmation
- manually merge pull request GH #1858 from fredposner, fred at qxork dot com
---
Modified: utils/kamctl/kamctlrc
Modified: utils/kamctl/kamdbctl
Modified: utils/kamctl/xhttp_pi/pi_framework.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/61eb1ac798ba3023fc51373a3fa824c…
Patch:
https://github.com/kamailio/kamailio/commit/61eb1ac798ba3023fc51373a3fa824c…
---
diff --git a/utils/kamctl/kamctlrc b/utils/kamctl/kamctlrc
index d6e927fe84..0c00d793c3 100644
--- a/utils/kamctl/kamctlrc
+++ b/utils/kamctl/kamctlrc
@@ -15,7 +15,7 @@
#
# If you want to setup a database with kamdbctl, you must at least specify
# this parameter.
-# DBENGINE=MYSQL
+DBENGINE=MYSQL
## database host
# DBHOST=localhost
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index 45ed0f50d9..4597afe09b 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -375,6 +375,14 @@ case $1 in
drop)
# delete kamailio database
# create new database structures
+
+ # confirm dropping of database
+ echo -e "This will drop your current database.\nIt is recommended to first backup
your database.\n"
+ get_answer ask "Continue with drop? (y/n): "
+ if [ "$ANSWER" != "y" ]; then
+ exit 1
+ fi
+
shift
if [ $# -eq 1 ] ; then
DBNAME="$1"
diff --git a/utils/kamctl/xhttp_pi/pi_framework.xml
b/utils/kamctl/xhttp_pi/pi_framework.xml
index 81cda70f50..7993b4cc2f 100644
--- a/utils/kamctl/xhttp_pi/pi_framework.xml
+++ b/utils/kamctl/xhttp_pi/pi_framework.xml
@@ -219,6 +219,17 @@
<column><field>attrs</field><type>DB1_STR</type></column>
<column><field>description</field><type>DB1_STR</type></column>
</db_table>
+ <!-- Declaration of domainpolicy table-->
+ <db_table id="domainpolicy">
+ <table_name>domainpolicy</table_name>
+ <db_url_id>mysql</db_url_id>
+ <column><field>id</field><type>DB1_INT</type></column>
+ <column><field>rule</field><type>DB1_STR</type></column>
+ <column><field>type</field><type>DB1_STR</type></column>
+ <column><field>att</field><type>DB1_STR</type></column>
+ <column><field>val</field><type>DB1_STR</type></column>
+ <column><field>description</field><type>DB1_STR</type></column>
+ </db_table>
<!-- Declaration of domain table-->
<db_table id="domain">
<table_name>domain</table_name>
@@ -239,17 +250,6 @@
<column><field>value</field><type>DB1_STR</type></column>
<column><field>last_modified</field><type>DB1_DATETIME</type></column>
</db_table>
- <!-- Declaration of domainpolicy table-->
- <db_table id="domainpolicy">
- <table_name>domainpolicy</table_name>
- <db_url_id>mysql</db_url_id>
- <column><field>id</field><type>DB1_INT</type></column>
- <column><field>rule</field><type>DB1_STR</type></column>
- <column><field>type</field><type>DB1_STR</type></column>
- <column><field>att</field><type>DB1_STR</type></column>
- <column><field>val</field><type>DB1_STR</type></column>
- <column><field>description</field><type>DB1_STR</type></column>
- </db_table>
<!-- Declaration of dr_gateways table-->
<db_table id="dr_gateways">
<table_name>dr_gateways</table_name>