diff --git a/setup/mysql/alter_tables.mysql b/setup/mysql/alter_tables.mysql index ac87796..bdca692 100644 --- a/setup/mysql/alter_tables.mysql +++ b/setup/mysql/alter_tables.mysql @@ -1,794 +1,794 @@ update log set reedit = SUBSTRING(reedit,10); update log set rerun = SUBSTRING(rerun,10); alter table auth_user change column only_customer domainFilter varchar(255) not null; alter table auth_user change column only_cscode codeFilter varchar(255) not null; alter table auth_user change column only_cli aNumberFilter varchar(255) not null; alter table auth_user change column only_after_date afterDateFilter varchar(255) not null; alter table auth_user drop column only_cardservice; alter table auth_user drop column only_cardclass; alter table active_sessions add column count bigint(20) unsigned NOT NULL default '0' after changed; alter table radacct change column Rate Rate text not null; alter table radacct add column SipMethod varchar(50) not null after H323ConfID; alter table radacct add column SipResponseCode smallint unsigned not null after SipMethod; alter table radacct add column SipToTag varchar(255) not null after SipResponseCode; alter table radacct add column SipFromTag varchar(255) not null after SipToTag; alter table radacct add column SipTranslatedRequestURI varchar(255) NOT NULL after SipFromTag; INSERT INTO sip_status VALUES (422,'SessionTimerTooSmall','Client-Error'); INSERT INTO sip_status VALUES (202,'Accepted','Success'); INSERT INTO sip_status VALUES (489,'UnknownEvent','Client-Error'); INSERT INTO sip_status VALUES (490,'RequestUpdated','Client-Error'); INSERT INTO sip_status VALUES (580,'PreconditionFailure','Server-Error'); INSERT INTO sip_status VALUES (421,'ExtensionRequired','Client-Error'); # v 1.4.4 alter table auth_user change column display_card compidFilter varchar(255) not null; alter table auth_user add column serviceFilter varchar(255) not null after codeFilter; alter table auth_user change column codeFilter cscodeFilter varchar(255) not null; # v 1.5.3 alter table radacct add column RemotePartyId varchar(255) not null ; alter table radacct add column BillingPartyId varchar(255) not null ; alter table radacct add column SIPAccount varchar(255) not null ; # v 1.6 alter table cdrtool.destinations add column gateway varchar(50) not null after id; alter table cdrtool.destinations add column domain varchar(50) not null after gateway; alter table cdrtool.destinations add column subscriber varchar(50) not null after domain; alter table cdrtool.billing_customers add column profileNGN varchar(10) not null; CREATE TABLE cdrtool.billing_profilesNGN ( id bigint(20) unsigned NOT NULL auto_increment, name varchar(25) NOT NULL default '', rate varchar(25) NOT NULL default '', application varchar(255) NOT NULL, PRIMARY KEY (id), KEY name_idx (name) ) ; CREATE TABLE cdrtool.billing_ratesNGN ( id bigint(20) unsigned NOT NULL auto_increment, name varchar(25) NOT NULL default '', TrafficRate varchar(25) NOT NULL default '', ConnectCost varchar(255) NOT NULL, PRIMARY KEY (id), KEY name_idx (name) ) ; # v 1.7 CREATE TABLE ser.user_quota ( id int(10) unsigned NOT NULL auto_increment, username varchar(64) NOT NULL default '', domain varchar(128) NOT NULL default '', notify_address varchar(255) NOT NULL default '', notified smallint unsigned not null, cost varchar(128) NOT NULL default '', traffic varchar(128) NOT NULL, PRIMARY KEY (id), INDEX sipuser (username, domain) ); alter table radacct add index caller_idx (CallingStationId); alter table radacct add index called_idx (CalledStationId); alter table radacct add column SipUserAgents varchar(255) NOT NULL after SipTranslatedRequestURI; alter table radacct add column SipApplicationType varchar(255) NOT NULL after SipUserAgents; alter table radacct add column SipCodecs varchar(255) NOT NULL after SipApplicationType; update radacct set SipToTag = H323ConfID; update radacct set SipFromTag = H323CallOrigin; update radacct set SipTranslatedRequestURI = H323RemoteAddress; update radacct set SipMethod = H323CallType; update radacct set SipResponseCode = H323DisconnectCause; update radacct set SipCodecs = FramedProtocol; update radacct set UserName= CONCAT(UserName,'@',Realm) where UserName not like '%@%'; update radacct set SipUserAgents = NASPortType; alter table radacct drop column BillingPartyId; alter table radacct drop column RemotePartyId; alter table radacct change column SipToTag SipToTag varchar(128) not null; alter table radacct change column SipFromTag SipFromTag varchar(128) not null; alter table radacct drop index sess_id; alter table radacct add unique sess_id(AcctSessionId(128),SipFromTag,SipToTag) alter table radacct drop column H323GWID; alter table radacct drop column H323CallOrigin; alter table radacct drop column H323CallType; alter table radacct drop column H323SetupTime; alter table radacct drop column H323ConnectTime; alter table radacct drop column H323DisconnectTime; alter table radacct drop column H323DisconnectCause; alter table radacct drop column H323RemoteAddress; alter table radacct drop column H323VoiceQuality; alter table radacct drop column H323ConfID; alter table cdrtool.billing_customers add column timezone varchar(128) not null; 2.0.2 alter table radacct drop column Redirected; 2.0.3 Add to sql.conf accounting_stop_query_alt = "UPDATE ${acct_table1} SET AcctStopTime = '%S',AcctSessionTime=unix_timestamp('%S') - unix_timestamp(AcctStartTime),AcctTerminateCause = '%{SIP-Response-Code}', AcctStopDelay ='%{Acct-Delay-Time}', ConnectInfo_stop = '%{Connect-Info}' WHEREAcctSessionId = '%{Acct-Session-Id}' AND (SipToTag = 'n/a' AND (SipFromTag= '%{Sip-From-Tag}' OR SipFromTag = '%{Sip-To-Tag}')) AND NASIPAddress ='%{NAS-IP-Address}'" 2.1.3 alter table radacct add column SipRPID varchar(25) not null after SipCodecs; 2.2 insert into sip_status values ('430','Quota exceeded','Client-Error'); 2.3 alter table billing_customers add unique cust_idx (gateway,domain,subscriber); alter table destinations add unique cust_dest_idx (gateway,domain,subscriber,dest_id); alter table billing_profiles add unique profile_idx (name,hour1,hour2,hour3,hour4); alter table billing_rates add unique rate_idx (name,destination); alter table billing_ratesNGN add unique rate_idx (name); alter table billing_profilesNGN add unique profile_idx (name,application); 2.5.3 insert into sip_status values ('477','SendingError','Client-Error'); insert into sip_status values ('478','UnresolvableNextHopAddress','Client-Error'); insert into sip_status values ('479','UnparseableURI ','Client-Error'); 2.5.5 insert into sip_status values ('434','User not online','Client-Error'); 2.5.9 update sip_status set description = 'Canceled' where code = '487'; update sip_status set description = 'Busy' where code = '486'; update sip_status set description = 'TemporarilyUnavailable' where code = '480'; update sip_status set description = 'NotAcceptable' where code = '488'; update sip_status set description = 'Timeout' where code = '408'; update sip_status set description = 'NotOnline' where code = '434'; 2.6.0 alter table radacct add column SipRPIDHeader varchar(255) not null after SipRPID; alter table radacct add column SourceIP varchar(255) not null; alter table radacct add column SourcePort varchar(255) not null; alter table radacct add column CanonicalURI varchar(255) not null; alter table radacct add column DelayTime varchar(5) not null; alter table radacct add column BillingId varchar(255) not null; insert into sip_status VALUES ('492','CrossReferencedURI','Client-Error'); alter table sip_status add column isdn_cause smallint(5) unsigned not null; update sip_status set isdn_cause = '57' where code = 401; update sip_status set isdn_cause = '21' where code = 402; update sip_status set isdn_cause = '57' where code = 403; update sip_status set isdn_cause = '1' where code = 404; update sip_status set isdn_cause = '127' where code = 405; update sip_status set isdn_cause = '127' where code = 406; update sip_status set isdn_cause = '21' where code = 407; update sip_status set isdn_cause = '10' where code = 408; update sip_status set isdn_cause = '41' where code = 409; update sip_status set isdn_cause = '1' where code = 410; update sip_status set isdn_cause = '127' where code = 413; update sip_status set isdn_cause = '127' where code = 414; update sip_status set isdn_cause = '79' where code = 415; update sip_status set isdn_cause = '127' where code = 420; update sip_status set isdn_cause = '127' where code = 422; update sip_status set isdn_cause = '18' where code = 480; update sip_status set isdn_cause = '127' where code = 481; update sip_status set isdn_cause = '127' where code = 482; update sip_status set isdn_cause = '127' where code = 483; update sip_status set isdn_cause = '28' where code = 484; update sip_status set isdn_cause = '1' where code = 485; update sip_status set isdn_cause = '17' where code = 486; update sip_status set isdn_cause = '127' where code = 487; update sip_status set isdn_cause = '127' where code = 488; update sip_status set isdn_cause = '41' where code = 500; update sip_status set isdn_cause = '79' where code = 501; update sip_status set isdn_cause = '38' where code = 502; update sip_status set isdn_cause = '63' where code = 503; update sip_status set isdn_cause = '102' where code = 504; update sip_status set isdn_cause = '127' where code = 505; update sip_status set isdn_cause = '47' where code = 580; update sip_status set isdn_cause = '17' where code = 600; update sip_status set isdn_cause = '21' where code = 603; update sip_status set isdn_cause = '1' where code = 604; update sip_status set isdn_cause = '58' where code = 606; 3.0 CREATE TABLE prepaid ( id int(10) unsigned NOT NULL auto_increment, account varchar(255) NOT NULL default '', balance decimal(10,4) not NULL default '0.0000', balance_previous decimal(10,4) not NULL, change_date datetime not null, PRIMARY KEY (id), INDEX acc_id (account) ); 3.0.3 alter table cdrtool.log add column datasource varchar(255) not null; update cdrtool.log set datasource = SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(rerun, '?','-1'),'&','1'),'=','-1') ; 3.1.2 alter table radius.radacct add index canon_idx (CanonicalURI); alter table ser.sip_trace add index call_id(callid); alter table prepaid add column last_call_price decimal(10,4) not null; alter table prepaid add column expires date not null after change_date; alter table prepaid add column disabled char(1) not null after expires; alter table prepaid add column call_in_progress datetime not null after disabled; alter table billing_customers add column profile_name1_alt varchar(10) not null after profile_name1; alter table billing_customers add column profile_name2_alt varchar(10) not null after profile_name2; 3.2 insert into settings (var_name,var_description,var_value) values ('reloadRating','Rating tables have changed',''); 3.2.2 alter table radacct change column Price Price double(20, 4); 3.2.4 alter table prepaid add column call_lock enum ('0','1') default '0' after disabled; alter table prepaid change column disabled disabled enum ('0','1') default '0' after account; alter table prepaid drop index acc_id; alter table prepaid add unique index acc_id(account); 3.2.7 alter table cdrtool.settings add column billing_party varchar(255) not null after id; insert into cdrtool.settings (billing_party,var_name,var_value) values ('domain.com','providerName','Provider Name'); insert into cdrtool.settings (billing_party,var_name,var_value) values ('domain.com','fromEmail','support@example.com'); 3.3.2 alter table cdrtool.billing_rates add column gateway varchar(50) NOT NULL default '' after id; alter table cdrtool.billing_rates add column domain varchar(50) NOT NULL default '' after gateway; alter table cdrtool.billing_rates add column subscriber varchar(50) NOT NULL default '' after domain; alter table cdrtool.billing_profiles add column gateway varchar(50) NOT NULL default '' after id; alter table cdrtool.billing_profiles add column domain varchar(50) NOT NULL default '' after gateway; alter table cdrtool.billing_profiles add column subscriber varchar(50) NOT NULL default '' after domain; alter table cdrtool.billing_ratesNGN add column gateway varchar(50) NOT NULL default '' after id; alter table cdrtool.billing_ratesNGN add column domain varchar(50) NOT NULL default '' after gateway; alter table cdrtool.billing_ratesNGN add column subscriber varchar(50) NOT NULL default '' after domain; alter table cdrtool.billing_profilesNGN add column gateway varchar(50) NOT NULL default '' after id; alter table cdrtool.billing_profilesNGN add column domain varchar(50) NOT NULL default '' after gateway; alter table cdrtool.billing_profilesNGN add column subscriber varchar(50) NOT NULL default '' after domain; alter table cdrtool.destinations drop column asr; alter table cdrtool.prepaid drop column disabled; alter table cdrtool.prepaid drop column balance_previous; alter table cdrtool.prepaid drop column expires; alter table cdrtool.prepaid add column maxsessiontime bigint unsigned not null; alter table cdrtool.prepaid add column destination varchar(50) not null; 3.3.4 alter table radacct drop index FramedIPAddress; alter table radacct add index source_ip_idx (SourceIP); alter table radacct add index billing_id_idx (BillingId); alter table radacct add index dest_id_idx (DestinationId); alter table radacct drop column CiscoNASPort; 3.3.5 alter table asterisk_cdr add index calldate_idx (calldate); alter table asterisk_cdr add index clid_idx (clid); alter table asterisk_cdr add index src_idx (src); alter table asterisk_cdr add index dst_idx (dst); alter table asterisk_cdr add index channel_idx (channel); alter table asterisk_cdr add index dstchannel_idx (dstchannel); 3.3.6 alter table radacct add index sip_req_uri_idx (SipTranslatedRequestURI); alter table radacct add index sip_req_uri_idx (SIPAccount); 3.4.0 alter table radacct add index normalize_idx(Normalized); 4.0.3 alter table radacct add column MediaInfo varchar(32) default NULL; alter table radacct add index MediaInfo_idx(MediaInfo); update radacct set MediaInfo = '' where AcctStopTime != '0000-00-00 00:00:00'; update radacct set MediaInfo = 'timeout' where AcctStopTime = '0000-00-00 00:00:00' and AcctSessionTime > 0; update radacct set MediaInfo = 'timeout' where AcctStopTime = '0000-00-00 00:00:00' and AcctInputOctets > 0; update radacct set MediaInfo = 'timeout' where AcctStopTime = '0000-00-00 00:00:00' and AcctOutputOctets > 0; update radacct set MediaInfo = 'timeout' where AcctStopTime = '0000-00-00 00:00:00' and SipCodecs != ''; 4.1.2 alter table radacct add index Realm_idx(Realm); 4.1.3 alter table settings change column var_value var_value text not null; 4.1.2 alter table radacct add column RTPStatistics text not null after MediaInfo; 4.2 CREATE TABLE `prepaid_history` ( `id` bigint(20) unsigned NOT NULL auto_increment, `username` varchar(64) NOT NULL default '', `domain` varchar(64) NOT NULL default '', `action` varchar(255) NOT NULL default '', `number` varchar(255) NOT NULL default '', `value` float(10,2) NOT NULL default '0.00', `balance` float(10,2) NOT NULL default '0.00', `date` datetime default NULL, PRIMARY KEY (`id`), KEY `acct_id` (`username`,`domain`) ); CREATE TABLE `prepaid_cards` ( `id` bigint(20) unsigned NOT NULL auto_increment, `batch` varchar(255) NOT NULL default '', `number` bigint(20) unsigned NOT NULL default '0', `value` smallint(5) unsigned NOT NULL default '0', `blocked` enum('0','1') NOT NULL default '0', `date_active` date NOT NULL default '0000-00-00', `date_batch` date NOT NULL default '0000-00-00', `service` varchar(255) NOT NULL default 'sip', PRIMARY KEY (`id`), UNIQUE KEY `card_idx` (`number`), KEY `nr_id` (`number`) ); alter table radacct add column FromHeader varchar(128) not null, add column UserAgent varchar(128) not null, add column Contact varchar(128) not null; 4.3 update radacct set SIPApplicationType = 'audio' where SIPApplicationType=''; 4.3.1 alter table asterisk_cdr change column Rate Rate text not null; 4.4.5 update radacct set CalledStationId = trim(leading 'sip:' from trim(leading 'sips:' from CalledStationId)), CallingStationId = trim(leading 'sip:' from trim(leading 'sips:' from CallingStationId)), CanonicalURI = trim(leading 'sip:' from trim(leading 'sips:' from CanonicalURI)), SipTranslatedRequestURI = trim(leading 'sip:' from trim(leading 'sips:' from SipTranslatedRequestURI)) where Normalized = 1 and CalledStationId like 'sip:%'; 4.4.6 INSERT INTO sip_status VALUES (435,'Diverted','Client-Error','0'); 4.5.9 alter table log add index login_idx(login); 4.6-4 update sip_status set description = 'NotAcceptableMedia' where code = 488; 4.7-0 DROP TABLE IF EXISTS `memcache`; CREATE TABLE `memcache` ( `key` varchar(255) NOT NULL, `value` text NOT NULL, PRIMARY KEY (`key`) ) ; 4.7-6 alter table billing_customers add column increment smallint unsigned not null; alter table billing_customers add column min_duration smallint unsigned not null; 4.8.1 alter table asterisk_cdr change column disposition disposition varchar(45) not null default ''; 5.0-2 alter table billing_profiles drop index `profile_idx` ; alter table billing_profiles add UNIQUE KEY `profile_idx` (`gateway`,`domain`,`subscriber`,`name`); alter table billing_rates drop index `rate_idx` ; alter table billing_rates add UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`name`,`destination`); alter table billing_customers add column country_code varchar(8) not NULL; alter table billing_profilesNGN drop index `profile_idx` ; alter table billing_profilesNGN add UNIQUE KEY `profile_idx` (`gateway`,`domain`,`subscriber`,`name`); alter table billing_ratesNGN drop index `rate_idx` ; alter table billing_ratesNGN add UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`name`); 5.0.10 alter table destinations change column dest_id dest_id varchar(100) not null; alter table billing_rates change column destination destination varchar(100) not null; 5.1.0 alter table billing_rates change column `name` `name` varchar(25) not null; alter table billing_profiles change column `name` `name` varchar(25) not null; alter table billing_customers change column `profile_name1` `profile_name1` varchar(25) not null; alter table billing_customers change column `profile_name1_alt` `profile_name1_alt` varchar(25) not null; alter table billing_customers change column `profile_name2` `profile_name2` varchar(25) not null; alter table billing_customers change column `profile_name2_alt` `profile_name2_alt` varchar(25) not null; CREATE TABLE `billing_rates_history` ( `id` bigint(20) unsigned NOT NULL auto_increment, `gateway` varchar(50) NOT NULL default '', `domain` varchar(50) NOT NULL default '', `subscriber` varchar(50) NOT NULL default '', `name` varchar(25) NOT NULL default '', `destination` varchar(100) NOT NULL default '', `durationRate` varchar(25) NOT NULL default '', `trafficRate` varchar(25) NOT NULL default '', `application` varchar(25) NOT NULL default '', `connectCost` varchar(25) NOT NULL default '', `startDate` date NOT NULL, `endDate` date NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`name`,`destination`,`application`,`startDate`,`endDate`), KEY `name_idx` (`name`), KEY `dest_idx` (`destination`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; alter table billing_rates change column applicationRate application varchar(25) not null default 'audio'; update billing_rates set application ='audio'; update billing_rates_history set application ='audio'; alter table billing_customers drop column profileNGN; alter table billing_rates drop index rate_idx; alter table billing_rates add UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`name`,`destination`,`application`); 5.2.1 Apply again the MySQL stored procedures to radius database from: setup/radius/OpenSER/radius_accounting.proc 5.2.7 alter table auth_user add column reseller bigint unsigned not null; CREATE TABLE `billing_enum_tlds` ( `id` bigint(20) unsigned NOT NULL auto_increment, `gateway` varchar(50) NOT NULL default '', `domain` varchar(50) NOT NULL default '', `subscriber` varchar(50) NOT NULL default '', `enum_tld` varchar(100) NOT NULL, `e164_regexp` varchar(100) NOT NULL, `discount` varchar(25) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `enum_idx` (`gateway`,`domain`,`subscriber`,`enum_tld`), KEY `tld_idx` (`enum_tld`) ); INSERT into billing_enum_tlds (enum_tld,e164_regexp,discount) values ('e164.example.com','([1-9][0-9]{7,})','25'); alter table radius.radacctYYYMMDD change column FramedProtocol ENUMtld varchar(64) not NULL; 5.4 alter table prepaid_cards change column blocked blocked smallint unsigned not null; alter table prepaid_history change column value value decimal(10,4) not null; alter table prepaid_history change column balance balance decimal(10,4) not null; alter table auth_user change column reseller impersonate varchar(50) not null; 6.2.3 alter table cdrtool.billing_customers change column domain domain varchar(64) not null; alter table cdrtool.billing_customers change column subscriber subscriber varchar(128) not null; alter table cdrtool.billing_customers change column gateway gateway varchar(15) not null; alter table cdrtool.billing_profiles change column domain domain varchar(64) not null; alter table cdrtool.billing_profiles change column subscriber subscriber varchar(128) not null; alter table cdrtool.billing_profiles change column gateway gateway varchar(15) not null; alter table cdrtool.billing_rates change column domain domain varchar(64) not null; alter table cdrtool.billing_rates change column subscriber subscriber varchar(128) not null; alter table cdrtool.billing_rates change column gateway gateway varchar(15) not null; alter table cdrtool.billing_rates_history change column domain domain varchar(64) not null; alter table cdrtool.billing_rates_history change column subscriber subscriber varchar(128) not null; alter table cdrtool.billing_rates_history change column gateway gateway varchar(15) not null; alter table cdrtool.billing_enum_tlds change column domain domain varchar(64) not null; alter table cdrtool.billing_enum_tlds change column subscriber subscriber varchar(128) not null; alter table cdrtool.billing_enum_tlds change column gateway gateway varchar(15) not null; alter table cdrtool.billing_ratesNGN change column domain domain varchar(64) not null; alter table cdrtool.billing_ratesNGN change column subscriber subscriber varchar(128) not null; alter table cdrtool.billing_ratesNGN change column gateway gateway varchar(15) not null; alter table cdrtool.prepaid change column account account varchar(128) not null; optimize table billing_rates; optimize table billing_rates_history; optimize table billing_customers; optimize table billing_profiles; optimize table prepaid; 6.3.3 DROP TABLE IF EXISTS `quota_usage`; CREATE TABLE `quota_usage` ( `id` int(10) unsigned NOT NULL auto_increment, `datasource` varchar(50) NOT NULL, `account` varchar(128) NOT NULL default '', `domain` varchar(64) default NULL, `quota` int(11) unsigned NOT NULL, `blocked` enum('0','1') NOT NULL default '0', `notified` datetime NOT NULL, `calls` int(10) unsigned NOT NULL, `duration` bigint(20) unsigned NOT NULL, `cost` decimal(10,4) NOT NULL, `traffic` varchar(50) NOT NULL, `change_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `account_idx` (`datasource`,`account`) ); alter table memcache change `value` `value` longblob not null; 6.6.0 alter table prepaid add column active_sessions text not null; alter table prepaid add column session_counter int unsigned not null; 6.7.0 alter table billing_rates drop column trafficRate; alter table cdrtool.billing_rates_history drop column trafficRate; alter table billing_rates_history modify application varchar(25) not null default 'audio' after destination; alter table billing_rates modify application varchar(25) not null default 'audio' after destination; alter table billing_rates_history modify connectCost varchar(25) not null after application; alter table billing_rates modify connectCost varchar(25) not null after application; alter table billing_rates add column connectCostIn varchar(25) not null; alter table billing_rates add column durationRateIn varchar(25) not null; alter table cdrtool.billing_rates_history add column connectCostIn varchar(25) not null after durationRate; alter table cdrtool.billing_rates_history add column durationRateIn varchar(25) not null after connectCostIn; alter table prepaid_history add column duration bigint unsigned not null after action; alter table prepaid_history add column session varchar(255) not null after duration; alter table prepaid_history add column destination varchar (15) not null after duration; alter table prepaid_history add index session_idx(session); alter table prepaid add column duration bigint(20) unsigned not null after destination; alter table prepaid add column domain varchar(128) not null after account; update prepaid set domain = SUBSTRING_INDEX(account, '@',-1); 6.7.6 alter table prepaid drop column call_lock; 6.8.0 alter table prepaid_history change column `number` `description` varchar(255) not null; alter table billing_rates add column increment smallint unsigned not null; alter table billing_rates add column min_duration smallint unsigned not null; alter table billing_rates_history add column increment smallint unsigned not null after durationRateIn; alter table billing_rates_history add column min_duration smallint unsigned not null after increment; alter table prepaid drop column call_lock; alter table prepaid drop column call_in_progress; alter table prepaid add column reseller_id int(10) unsigned not NULL after id; alter table prepaid add key reseller_idx (reseller_id); alter table prepaid_cards add column reseller_id int(10) unsigned not NULL after id; alter table prepaid_cards add key reseller_idx (reseller_id); alter table prepaid_history add column reseller_id int(10) unsigned not NULL after id; alter table prepaid_history add key reseller_idx (reseller_id); alter table quota_usage add column reseller_id int(10) unsigned not NULL after id; alter table quota_usage add key reseller_idx (reseller_id); alter table billing_customers add column reseller_id int(10) unsigned not NULL after id; alter table billing_customers add key reseller_idx (reseller_id); alter table billing_customers drop column country_code; alter table billing_profiles add column reseller_id int(10) unsigned not NULL after id; alter table billing_profiles add key reseller_idx (reseller_id); alter table billing_rates add column reseller_id int(10) unsigned not NULL after id; alter table billing_rates add key reseller_idx (reseller_id); alter table billing_rates_history add column reseller_id int(10) unsigned not NULL after id; alter table billing_rates_history add key reseller_idx (reseller_id); alter table billing_enum_tlds add column reseller_id int(10) unsigned not NULL after id; alter table billing_enum_tlds add key reseller_idx (reseller_id); alter table destinations add column reseller_id int(10) unsigned not NULL after id; alter table destinations add key reseller_idx (reseller_id); alter table billing_profiles drop column gateway; alter table billing_profiles drop column subscriber; alter table billing_profiles drop column domain; alter table billing_rates drop column gateway; alter table billing_rates drop column subscriber; alter table billing_rates drop column domain; alter table billing_rates_history drop column gateway; alter table billing_rates_history drop column subscriber; alter table billing_rates_history drop column domain; alter table billing_enum_tlds drop column gateway; alter table billing_enum_tlds drop column subscriber; alter table billing_enum_tlds drop column domain; drop table billing_profilesNGN; drop table billing_ratesNGN; alter table log add column reseller_id int(10) unsigned not NULL after id; alter table log add key reseller_idx (reseller_id); alter table destinations drop KEY `cust_dest_idx`; alter table destinations add KEY `cust_dest_idx` (`reseller_id`,`gateway`,`domain`,`subscriber`,`dest_id`); alter table prepaid_cards change column `value` `value` decimal(10,4) default 0; alter table billing_rates add column `maxPrice` varchar(25) NOT NULL default ''; alter table prepaid drop column last_call_price; alter table prepaid drop column destination; alter table prepaid drop column duration; alter table prepaid drop column maxsessiontime; 6.9.3 alter table prepaid drop column domain; 6.7.0 alter table prepaid add column max_sessions int(10) unsigned not null default 1; alter table billing_enum_tlds drop KEY `enum_idx`; alter table billing_enum_tlds add UNIQUE `enum_idx` (`reseller_id`,`enum_tld`); alter table billing_rates drop KEY `rate_idx`; alter table billing_rates add UNIQUE `rate_idx` (`reseller_id`,`name`,`destination`,`application`); alter table billing_rates_history drop KEY `rate_idx`; alter table billing_rates_history add UNIQUE `rate_idx` (`reseller_id`,`name`,`destination`,`startDate`,`endDate`,`application`); alter table billing_profiles drop KEY `name_idx`; alter table billing_profiles add UNIQUE `name_idx` (`reseller_id`,`name`); alter table billing_rates drop column maxPrice; alter table billing_rates drop column min_duration; alter table billing_rates drop column increment; alter table billing_rates_history drop column min_duration; alter table billing_rates_history drop column increment; alter table billing_customers drop column min_duration; alter table billing_customers drop column increment; alter table destinations add column increment smallint unsigned not null; alter table destinations add column min_duration smallint unsigned not null; alter table destinations add column max_duration bigint unsigned not null; alter table destinations add column max_price varchar(25) NOT NULL default ''; 7.1.1 CREATE TABLE `subscriber_docs` ( `id` int(11) NOT NULL auto_increment, `username` varchar(64) NOT NULL, `domain` varchar(64) NOT NULL, `name` varchar(64) NOT NULL, `document` varchar(64) NOT NULL, `file_content` mediumblob NOT NULL, `file_name` varchar(255) NOT NULL default '', `file_size` varchar(255) NOT NULL default '', `file_type` varchar(255) NOT NULL default '', `file_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_digits` varchar(64) NOT NULL, `mobile_number` varchar(15) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `document_idx` (`username`,`domain`,`document`) ); 8.0.0 alter table destinations add column region varchar(50) not null after dest_id ; drop table if exists billing_discounts; CREATE TABLE `billing_discounts` ( `id` bigint(20) unsigned NOT NULL auto_increment, `reseller_id` int(10) unsigned not NULL, `gateway` varchar(50) NOT NULL default '', `domain` varchar(50) NOT NULL default '', `subscriber` varchar(50) NOT NULL default '', `application` varchar(25) NOT NULL default '', `destination` varchar(100) NOT NULL default '', `region` varchar(25) NOT NULL default '', `connect` smallint unsigned NOT NULL, `duration` smallint unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`destination`,`region`), KEY `name_idx` (`region`), KEY `dest_idx` (`destination`) ) ; alter table quota_usage add column cost_today decimal(10,4) not null after cost; alter table log change column login login varchar(128) not null; alter table billing_customers add column increment smallint unsigned not null; alter table billing_customers add column min_duration smallint unsigned not null; 8.0.20 INSERT INTO sip_status VALUES (476,'UnresolvableDestination','Client-Error','0'); 8.1.0 To setup SQL tables to support microsecond datetime accuracy see: setup/radius/OpenSIPS/now_usec.readme 8.2.6 alter table auth_user add password_hashed varchar(32) not null default '' after password; update auth_user set password_hashed=MD5(password),password='' where password!=''; 8.3.1 drop table if exists client_journal; CREATE TABLE `client_journal` ( `id` bigint(20) unsigned NOT NULL auto_increment, `timestamp` datetime NOT NULL default '0000-00-00 00:00:00', `account` varchar(128) NOT NULL default '', `uuid` varchar(256) NOT NULL default '', `ip_address` varchar(256) NOT NULL default '', `data` longblob NOT NULL, PRIMARY KEY (`id`), KEY `account_idx` (`account`), KEY `uuid_idx` (`uuid`) ); 9.2.0 alter table auth_user add column auth_method int(2); alter table auth_user add column yubikey varchar(12); alter table billing_customers add index domain (`domain`); # for ngpro logs this needs to be put in ngnpro customer DB CREATE TABLE `ngnpro_logs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ip` varchar(15) DEFAULT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `total` int(11) DEFAULT NULL, `total_time` double DEFAULT NULL, PRIMARY KEY (`id`), KEY `dates` (`date`), KEY `ips` (`ip`) ); CREATE TABLE `ngnpro_logs_functions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ip` varchar(15) DEFAULT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `function` varchar(60) DEFAULT NULL, `total` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `dates` (`date`), KEY `ips` (`ip`), KEY `functions` (`ip`,`function`) ); CREATE TABLE `ngnpro_logs_summary` ( `id` int(11) NOT NULL AUTO_INCREMENT, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `total` int(11) DEFAULT NULL, `total_time` double DEFAULT NULL, PRIMARY KEY (`id`), KEY `dates` (`date`) ); 9.2.1 delete from sip_status where code='434'; alter table quota_usage add index account (`account`); -10.0.0 +9.4.0 alter table auth_user add column aclFilter varchar(255) not null after afterDateFilter; # Next two are only needed for ngnpro statistics # this needs to be put in ngnpro customer DB CREATE TABLE `ngnpro_logs_functions_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ip` varchar(15) DEFAULT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `function` varchar(60) DEFAULT NULL, `total` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `dates` (`date`), KEY `ips` (`ip`), KEY `functions` (`ip`,`function`) ); DELIMITER ;; CREATE TRIGGER `ngnpro_functions_rotate` BEFORE UPDATE ON `ngnpro_logs_functions` FOR EACH ROW BEGIN IF (DATE(OLD.date) < CURDATE()) THEN INSERT into `ngnpro_logs_functions_history` (ip,date,function,total) values (OLD.ip,OLD.date,OLD.function,OLD.total); set NEW.total = 1; END IF; END ;; DELIMITER ;