From 32dc161d2545bc4585b666fe3f483397adf69207 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 19 Mar 2012 21:44:41 +0000 Subject: [PATCH] Update 0030_create_kamailio_301.up + 0050_create_accounting.up + provide 5000_fix_billing.up This should bring our fresh installation into sync with upgraded systems. Hopefully. Finally. From: Michael Prokop --- db_scripts/base/0030_create_kamailio_301.up | 4 ++-- db_scripts/base/0050_create_accounting.up | 16 +--------------- db_scripts/base/5000_fix_billing.up | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 db_scripts/base/5000_fix_billing.up diff --git a/db_scripts/base/0030_create_kamailio_301.up b/db_scripts/base/0030_create_kamailio_301.up index 1019f156..1c3a7c65 100644 --- a/db_scripts/base/0030_create_kamailio_301.up +++ b/db_scripts/base/0030_create_kamailio_301.up @@ -12,7 +12,7 @@ CREATE TABLE `acc` ( `to_tag` varchar(64) NOT NULL DEFAULT '', `callid` varchar(64) NOT NULL DEFAULT '', `sip_code` varchar(3) NOT NULL DEFAULT '', - `sip_reason` varchar(32) NOT NULL DEFAULT '', + `sip_reason` varchar(128) NOT NULL DEFAULT '', `time` datetime NOT NULL, `src_leg` varchar(255) default NULL, `dst_leg` varchar(255) default NULL, @@ -23,7 +23,7 @@ CREATE TABLE `acc` ( `src_domain` varchar(128) NOT NULL default '', PRIMARY KEY (`id`), KEY `callid_idx` (`callid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `dbaliases` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, diff --git a/db_scripts/base/0050_create_accounting.up b/db_scripts/base/0050_create_accounting.up index 952388a9..7c553fb3 100644 --- a/db_scripts/base/0050_create_accounting.up +++ b/db_scripts/base/0050_create_accounting.up @@ -13,21 +13,7 @@ USE accounting; -- create accounting tables -CREATE TABLE `acc` ( - `id` int(10) unsigned NOT NULL auto_increment, - `method` varchar(16) NOT NULL default '', - `from_tag` varchar(64) NOT NULL default '', - `to_tag` varchar(64) NOT NULL default '', - `callid` varchar(128) NOT NULL default '', - `sip_code` char(3) NOT NULL default '', - `sip_reason` varchar(32) NOT NULL default '', - `time` datetime NOT NULL, - `src_leg` varchar(255) default NULL, - `dst_leg` varchar(255) default NULL, - `server` varchar(64) NOT NULL, - PRIMARY KEY (`id`), - KEY `acc_callid` (`callid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE `acc` like kamailio.acc; CREATE TABLE `cdr` ( `id` int(10) unsigned NOT NULL auto_increment, diff --git a/db_scripts/base/5000_fix_billing.up b/db_scripts/base/5000_fix_billing.up new file mode 100644 index 00000000..be97efb8 --- /dev/null +++ b/db_scripts/base/5000_fix_billing.up @@ -0,0 +1,14 @@ +USE billing; + +ALTER TABLE billing_fees_history ADD KEY `zonehid_idx` (`billing_zones_history_id`); +ALTER TABLE billing_fees_history ADD CONSTRAINT `b_f_h_bzhid_ref` FOREIGN KEY (`billing_zones_history_id`) + REFERENCES `billing_zones_history` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE; + +ALTER TABLE voip_subscribers DROP FOREIGN KEY `v_s_pnumid_ref`; +ALTER TABLE voip_subscribers ADD CONSTRAINT `v_s_pnumid_ref` FOREIGN KEY (`primary_number_id`) REFERENCES `voip_numbers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +ALTER TABLE billing_fees AUTO_INCREMENT=1000; +ALTER TABLE billing_fees_history AUTO_INCREMENT=1000; +ALTER TABLE billing_zones AUTO_INCREMENT=1000; +ALTER TABLE billing_zones_history AUTO_INCREMENT=1000;