root/setup/mysql/alter_tables.mysql

Revision 1751, 31.3 KB (checked in by Adrian Georgescu <ag@ag-projects.com>, 4 weeks ago)

Removed trial enrollment code

Line 
1update log  set reedit = SUBSTRING(reedit,10);
2update log  set rerun = SUBSTRING(rerun,10);
3alter table auth_user change column only_customer domainFilter varchar(255) not null;
4alter table auth_user change column only_cscode codeFilter varchar(255) not null;
5alter table auth_user change column only_cli aNumberFilter  varchar(255) not null;
6alter table auth_user change column only_after_date afterDateFilter varchar(255) not null;
7alter table auth_user drop column only_cardservice;
8alter table auth_user drop column only_cardclass;
9
10alter table active_sessions add column count bigint(20) unsigned NOT NULL default '0' after changed;
11alter table radacct change column Rate Rate text not null;
12
13alter table radacct add column SipMethod varchar(50) not null after H323ConfID;
14alter table radacct add column SipResponseCode smallint unsigned not null after SipMethod;
15alter table radacct add column SipToTag varchar(255) not null after SipResponseCode;
16alter table radacct add column SipFromTag varchar(255) not null after SipToTag;
17alter table radacct add column SipTranslatedRequestURI varchar(255) NOT NULL after SipFromTag;
18
19INSERT INTO sip_status VALUES (422,'SessionTimerTooSmall','Client-Error');
20INSERT INTO sip_status VALUES (202,'Accepted','Success');
21INSERT INTO sip_status VALUES (489,'UnknownEvent','Client-Error');
22INSERT INTO sip_status VALUES (490,'RequestUpdated','Client-Error');
23INSERT INTO sip_status VALUES (580,'PreconditionFailure','Server-Error');
24INSERT INTO sip_status VALUES (421,'ExtensionRequired','Client-Error');
25
26# v 1.4.4
27alter table auth_user change column display_card compidFilter varchar(255) not null;
28alter table auth_user add column serviceFilter varchar(255) not null after codeFilter;
29alter table auth_user change column codeFilter cscodeFilter varchar(255) not null;
30
31# v 1.5.3
32alter table radacct add column RemotePartyId varchar(255) not null ;
33alter table radacct add column BillingPartyId varchar(255) not null ;
34alter table radacct add column SIPAccount varchar(255) not null ;
35
36# v 1.6
37alter table cdrtool.destinations add column gateway varchar(50) not null after id;
38alter table cdrtool.destinations add column domain varchar(50) not null after gateway;
39alter table cdrtool.destinations add column subscriber varchar(50) not null after domain;
40alter table cdrtool.billing_customers add column profileNGN varchar(10) not null;
41
42CREATE TABLE cdrtool.billing_profilesNGN (
43  id bigint(20) unsigned NOT NULL auto_increment,
44  name varchar(25) NOT NULL default '',
45  rate varchar(25) NOT NULL default '',
46  application varchar(255) NOT NULL,
47  PRIMARY KEY  (id),
48  KEY name_idx (name)
49) ;
50
51CREATE TABLE cdrtool.billing_ratesNGN (
52  id bigint(20) unsigned NOT NULL auto_increment,
53  name varchar(25) NOT NULL default '',
54  TrafficRate varchar(25) NOT NULL default '',
55  ConnectCost varchar(255) NOT NULL,
56  PRIMARY KEY  (id),
57  KEY name_idx (name)
58) ;
59
60# v 1.7
61CREATE TABLE ser.user_quota ( 
62  id int(10) unsigned NOT NULL auto_increment,
63  username varchar(64) NOT NULL default '',
64  domain varchar(128) NOT NULL default '',
65  notify_address varchar(255) NOT NULL default '',
66  notified smallint unsigned not null,
67  cost varchar(128) NOT NULL default '',
68  traffic varchar(128) NOT NULL,
69  PRIMARY KEY  (id),
70  INDEX sipuser (username, domain)
71);
72
73alter table radacct add index caller_idx (CallingStationId);
74alter table radacct add index called_idx (CalledStationId);
75
76alter table radacct add column SipUserAgents varchar(255) NOT NULL after SipTranslatedRequestURI;
77alter table radacct add column SipApplicationType varchar(255) NOT NULL after SipUserAgents;
78alter table radacct add column SipCodecs varchar(255) NOT NULL after SipApplicationType;
79
80update radacct set SipToTag = H323ConfID;
81update radacct set SipFromTag = H323CallOrigin;
82update radacct set SipTranslatedRequestURI = H323RemoteAddress;
83update radacct set SipMethod = H323CallType;
84update radacct set SipResponseCode = H323DisconnectCause;
85update radacct set SipCodecs = FramedProtocol;
86update radacct set UserName= CONCAT(UserName,'@',Realm) where UserName not like '%@%';
87update radacct set SipUserAgents = NASPortType;
88
89alter table radacct drop column BillingPartyId;
90alter table radacct drop column RemotePartyId;
91
92alter table radacct change column SipToTag SipToTag varchar(128) not null;
93alter table radacct change column SipFromTag SipFromTag varchar(128) not null;
94
95alter table radacct drop index sess_id;
96alter table radacct add unique sess_id(AcctSessionId(128),SipFromTag,SipToTag)
97alter table radacct drop column H323GWID;
98alter table radacct drop column H323CallOrigin;
99alter table radacct drop column H323CallType;
100alter table radacct drop column H323SetupTime;
101alter table radacct drop column H323ConnectTime;
102alter table radacct drop column H323DisconnectTime;
103alter table radacct drop column H323DisconnectCause;
104alter table radacct drop column H323RemoteAddress;
105alter table radacct drop column H323VoiceQuality;
106alter table radacct drop column H323ConfID;
107
108alter table cdrtool.billing_customers add column timezone varchar(128) not null;
109
1102.0.2
111alter table radacct drop column Redirected;
112
1132.0.3
114Add to sql.conf
115accounting_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}'"
116
1172.1.3
118alter table radacct add column SipRPID varchar(25) not null after SipCodecs;
119
1202.2
121insert into sip_status values ('430','Quota exceeded','Client-Error');
122
1232.3
124alter table billing_customers add unique cust_idx (gateway,domain,subscriber);
125alter table destinations add unique cust_dest_idx (gateway,domain,subscriber,dest_id);
126alter table billing_profiles add unique profile_idx (name,hour1,hour2,hour3,hour4);
127alter table billing_rates add unique rate_idx (name,destination);
128alter table billing_ratesNGN add unique rate_idx (name);
129alter table billing_profilesNGN add unique profile_idx (name,application);
130
1312.5.3
132insert into sip_status values ('477','SendingError','Client-Error');
133insert into sip_status values ('478','UnresolvableNextHopAddress','Client-Error');
134insert into sip_status values ('479','UnparseableURI ','Client-Error');
135
1362.5.5
137insert into sip_status values ('434','User not online','Client-Error');
138
1392.5.9
140update sip_status set description = 'Canceled' where code = '487';
141update sip_status set description = 'Busy' where code = '486';
142update sip_status set description = 'TemporarilyUnavailable' where code = '480';
143update sip_status set description = 'NotAcceptable' where code = '488';
144update sip_status set description = 'Timeout' where code = '408';
145update sip_status set description = 'NotOnline' where code = '434';
146
1472.6.0
148alter table radacct add column SipRPIDHeader varchar(255) not null after SipRPID;
149alter table radacct add column SourceIP varchar(255) not null;
150alter table radacct add column SourcePort varchar(255) not null;
151alter table radacct add column CanonicalURI varchar(255) not null;
152alter table radacct add column DelayTime varchar(5) not null;
153alter table radacct add column BillingId varchar(255) not null;
154
155insert into sip_status VALUES ('492','CrossReferencedURI','Client-Error');
156alter table sip_status add column isdn_cause smallint(5) unsigned not null;
157update sip_status set isdn_cause = '57' where code = 401;
158update sip_status set isdn_cause = '21' where code = 402;
159update sip_status set isdn_cause = '57' where code = 403;
160update sip_status set isdn_cause = '1' where code = 404;
161update sip_status set isdn_cause = '127' where code = 405;
162update sip_status set isdn_cause = '127' where code = 406;
163update sip_status set isdn_cause = '21' where code = 407;
164update sip_status set isdn_cause = '10' where code = 408;
165update sip_status set isdn_cause = '41' where code = 409;
166update sip_status set isdn_cause = '1' where code = 410;
167update sip_status set isdn_cause = '127' where code = 413;
168update sip_status set isdn_cause = '127' where code = 414;
169update sip_status set isdn_cause = '79' where code = 415;
170update sip_status set isdn_cause = '127' where code = 420;
171update sip_status set isdn_cause = '127' where code = 422;
172update sip_status set isdn_cause = '18' where code = 480;
173update sip_status set isdn_cause = '127' where code = 481;
174update sip_status set isdn_cause = '127' where code = 482;
175update sip_status set isdn_cause = '127' where code = 483;
176update sip_status set isdn_cause = '28' where code = 484;
177update sip_status set isdn_cause = '1' where code = 485;
178update sip_status set isdn_cause = '17' where code = 486;
179update sip_status set isdn_cause = '127' where code = 487;
180update sip_status set isdn_cause = '127' where code = 488;
181update sip_status set isdn_cause = '41' where code = 500;
182update sip_status set isdn_cause = '79' where code = 501;
183update sip_status set isdn_cause = '38' where code = 502;
184update sip_status set isdn_cause = '63' where code = 503;
185update sip_status set isdn_cause = '102' where code = 504;
186update sip_status set isdn_cause = '127' where code = 505;
187update sip_status set isdn_cause = '47' where code = 580;
188update sip_status set isdn_cause = '17' where code = 600;
189update sip_status set isdn_cause = '21' where code = 603;
190update sip_status set isdn_cause = '1' where code = 604;
191update sip_status set isdn_cause = '58' where code = 606;
192
1933.0
194CREATE TABLE prepaid ( 
195  id int(10) unsigned NOT NULL auto_increment,
196  account varchar(255) NOT NULL default '',
197  balance decimal(10,4) not NULL default '0.0000',
198  balance_previous decimal(10,4) not NULL,
199  change_date datetime not null,
200  PRIMARY KEY  (id),
201  INDEX acc_id (account)
202);
203
2043.0.3
205alter table cdrtool.log add column datasource varchar(255) not null;
206update cdrtool.log set datasource = SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(rerun, '?','-1'),'&','1'),'=','-1') ;
207
2083.1.2
209alter table radius.radacct add index canon_idx (CanonicalURI);
210alter table ser.sip_trace add index call_id(callid);
211alter table prepaid add column last_call_price decimal(10,4)  not null;
212alter table prepaid add column expires date not null after change_date;
213alter table prepaid add column disabled char(1) not null after expires;
214alter table prepaid add column call_in_progress datetime not null after disabled;
215alter table billing_customers add column profile_name1_alt varchar(10) not null after profile_name1;
216alter table billing_customers add column profile_name2_alt varchar(10) not null after profile_name2;
217
2183.2
219insert into settings (var_name,var_description,var_value) values
220('reloadRating','Rating tables have changed','');
221
2223.2.2
223alter table radacct change column Price Price double(20, 4);
224
2253.2.4
226alter table prepaid add column call_lock enum ('0','1') default '0' after disabled;
227alter table prepaid change column disabled disabled enum ('0','1') default '0' after account;
228alter table prepaid drop index acc_id;
229alter table prepaid add unique index acc_id(account);
230
2313.2.7
232alter table cdrtool.settings add column billing_party varchar(255) not null after id;
233insert into cdrtool.settings (billing_party,var_name,var_value) values ('domain.com','providerName','Provider Name');
234insert into cdrtool.settings (billing_party,var_name,var_value) values ('domain.com','fromEmail','support@example.com');
235
2363.3.2
237alter table cdrtool.billing_rates add column gateway varchar(50) NOT NULL default '' after id;
238alter table cdrtool.billing_rates add column domain varchar(50) NOT NULL default ''  after gateway;
239alter table cdrtool.billing_rates add column subscriber varchar(50) NOT NULL default '' after domain;
240alter table cdrtool.billing_profiles add column gateway varchar(50) NOT NULL default '' after id;
241alter table cdrtool.billing_profiles add column domain varchar(50) NOT NULL default ''  after gateway;
242alter table cdrtool.billing_profiles add column subscriber varchar(50) NOT NULL default '' after domain;
243alter table cdrtool.billing_ratesNGN add column gateway varchar(50) NOT NULL default '' after id;
244alter table cdrtool.billing_ratesNGN add column domain varchar(50) NOT NULL default ''  after gateway;
245alter table cdrtool.billing_ratesNGN add column subscriber varchar(50) NOT NULL default '' after domain;
246alter table cdrtool.billing_profilesNGN add column gateway varchar(50) NOT NULL default '' after id;
247alter table cdrtool.billing_profilesNGN add column domain varchar(50) NOT NULL default ''  after gateway;
248alter table cdrtool.billing_profilesNGN add column subscriber varchar(50) NOT NULL default '' after domain;
249
250alter table cdrtool.destinations drop column asr;
251
252alter table cdrtool.prepaid drop column disabled;
253alter table cdrtool.prepaid drop column balance_previous;
254alter table cdrtool.prepaid drop column expires;
255alter table cdrtool.prepaid add column maxsessiontime bigint unsigned not null;
256alter table cdrtool.prepaid add column destination varchar(50) not null;
257
2583.3.4
259alter table radacct drop index FramedIPAddress;
260alter table radacct add index source_ip_idx (SourceIP);
261alter table radacct add index billing_id_idx (BillingId);
262alter table radacct add index dest_id_idx (DestinationId);
263alter table radacct drop column CiscoNASPort;
264
2653.3.5
266alter table asterisk_cdr add index calldate_idx (calldate);
267alter table asterisk_cdr add index clid_idx (clid);
268alter table asterisk_cdr add index src_idx (src);
269alter table asterisk_cdr add index dst_idx (dst);
270alter table asterisk_cdr add index channel_idx (channel);
271alter table asterisk_cdr add index dstchannel_idx (dstchannel);
272
2733.3.6
274alter table radacct add index sip_req_uri_idx (SipTranslatedRequestURI);
275alter table radacct add index sip_req_uri_idx (SIPAccount);
276
2773.4.0
278alter table radacct add index normalize_idx(Normalized);
279
2804.0.3
281alter table radacct add column MediaInfo varchar(32) default NULL;
282alter table radacct add index MediaInfo_idx(MediaInfo);
283update radacct set MediaInfo = '' where AcctStopTime != '0000-00-00 00:00:00';
284update radacct set MediaInfo = 'timeout' where AcctStopTime = '0000-00-00 00:00:00' and AcctSessionTime > 0;
285update radacct set MediaInfo = 'timeout' where AcctStopTime = '0000-00-00 00:00:00' and AcctInputOctets > 0;
286update radacct set MediaInfo = 'timeout' where AcctStopTime = '0000-00-00 00:00:00' and AcctOutputOctets > 0;
287update radacct set MediaInfo = 'timeout' where AcctStopTime = '0000-00-00 00:00:00' and SipCodecs != '';
288
2894.1.2
290alter table radacct add index Realm_idx(Realm);
291
2924.1.3
293alter table settings change column var_value var_value text not null;
294
2954.1.2
296alter table radacct add column RTPStatistics text not null after MediaInfo;
297
2984.2
299CREATE TABLE `prepaid_history` (
300  `id` bigint(20) unsigned NOT NULL auto_increment,
301  `username` varchar(64) NOT NULL default '',
302  `domain` varchar(64) NOT NULL default '',
303  `action` varchar(255) NOT NULL default '',
304  `number` varchar(255) NOT NULL default '',
305  `value` float(10,2) NOT NULL default '0.00',
306  `balance` float(10,2) NOT NULL default '0.00',
307  `date` datetime default NULL,
308  PRIMARY KEY  (`id`),
309  KEY `acct_id` (`username`,`domain`)
310);
311
312CREATE TABLE `prepaid_cards` (
313  `id` bigint(20) unsigned NOT NULL auto_increment,
314  `batch` varchar(255) NOT NULL default '',
315  `number` bigint(20) unsigned NOT NULL default '0',
316  `value` smallint(5) unsigned NOT NULL default '0',
317  `blocked` enum('0','1') NOT NULL default '0',
318  `date_active` date NOT NULL default '0000-00-00',
319  `date_batch` date NOT NULL default '0000-00-00',
320  `service` varchar(255) NOT NULL default 'sip',
321  PRIMARY KEY  (`id`),
322  UNIQUE KEY `card_idx` (`number`),
323  KEY `nr_id` (`number`)
324);
325
326alter table radacct
327add column FromHeader varchar(128) not null,
328add column UserAgent varchar(128) not null,
329add column Contact varchar(128) not null;
330
3314.3
332update radacct set SIPApplicationType = 'audio' where SIPApplicationType='';
333
3344.3.1
335alter table asterisk_cdr change column Rate Rate text not null;
336
3374.4.5
338update radacct set
339CalledStationId         = trim(leading 'sip:' from trim(leading 'sips:' from CalledStationId)),
340CallingStationId        = trim(leading 'sip:' from trim(leading 'sips:' from CallingStationId)),
341CanonicalURI            = trim(leading 'sip:' from trim(leading 'sips:' from CanonicalURI)),
342SipTranslatedRequestURI = trim(leading 'sip:' from trim(leading 'sips:' from SipTranslatedRequestURI))
343where Normalized = 1  and CalledStationId like 'sip:%';
344
3454.4.6
346INSERT INTO sip_status VALUES (435,'Diverted','Client-Error','0');
347
3484.5.9
349alter table log add index login_idx(login);
350
3514.6-4
352update sip_status set description = 'NotAcceptableMedia' where code = 488;
353
3544.7-0
355DROP TABLE IF EXISTS `memcache`;
356CREATE TABLE `memcache` (
357  `key` varchar(255) NOT NULL,
358  `value` text NOT NULL,
359  PRIMARY KEY  (`key`)
360) ;
361
3624.7-6
363alter table billing_customers add column increment smallint unsigned not null;
364alter table billing_customers add column min_duration smallint unsigned not null;
365
3664.8.1
367alter table asterisk_cdr change column disposition disposition varchar(45) not null default '';
368
3695.0-2
370alter table billing_profiles drop index `profile_idx` ;
371alter table billing_profiles add  UNIQUE KEY `profile_idx` (`gateway`,`domain`,`subscriber`,`name`);
372
373alter table billing_rates drop index `rate_idx` ;
374alter table billing_rates add  UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`name`,`destination`);
375
376alter table billing_customers add column country_code varchar(8) not NULL;
377
378alter table billing_profilesNGN drop index `profile_idx` ;
379alter table billing_profilesNGN add  UNIQUE KEY `profile_idx` (`gateway`,`domain`,`subscriber`,`name`);
380
381alter table billing_ratesNGN drop index `rate_idx` ;
382alter table billing_ratesNGN add  UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`name`);
383
3845.0.10
385alter table destinations change column dest_id dest_id varchar(100) not null;
386alter table billing_rates change column destination destination varchar(100) not null;
387
3885.1.0
389alter table billing_rates change column `name` `name` varchar(25) not null;
390alter table billing_profiles change column `name` `name` varchar(25) not null;
391alter table billing_customers change column `profile_name1` `profile_name1` varchar(25) not null;
392alter table billing_customers change column `profile_name1_alt` `profile_name1_alt` varchar(25) not null;
393alter table billing_customers change column `profile_name2` `profile_name2` varchar(25) not null;
394alter table billing_customers change column `profile_name2_alt` `profile_name2_alt` varchar(25) not null;
395
396CREATE TABLE `billing_rates_history` (
397  `id` bigint(20) unsigned NOT NULL auto_increment,
398  `gateway` varchar(50) NOT NULL default '',
399  `domain` varchar(50) NOT NULL default '',
400  `subscriber` varchar(50) NOT NULL default '',
401  `name` varchar(25) NOT NULL default '',
402  `destination` varchar(100) NOT NULL default '',
403  `durationRate` varchar(25) NOT NULL default '',
404  `trafficRate` varchar(25) NOT NULL default '',
405  `application` varchar(25) NOT NULL default '',
406  `connectCost` varchar(25) NOT NULL default '',
407  `startDate` date  NOT NULL,
408  `endDate` date  NOT NULL,
409  PRIMARY KEY  (`id`),
410  UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`name`,`destination`,`application`,`startDate`,`endDate`),
411  KEY `name_idx` (`name`),
412  KEY `dest_idx` (`destination`)
413) ENGINE=MyISAM DEFAULT CHARSET=latin1;
414
415alter table billing_rates change column applicationRate application varchar(25) not null default 'audio';
416
417update billing_rates set application ='audio';
418
419update billing_rates_history set application ='audio';
420
421alter table billing_customers drop column profileNGN;
422
423alter table billing_rates drop index rate_idx;
424
425alter table billing_rates add  UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`name`,`destination`,`application`);
426
427
4285.2.1
429Apply again the MySQL stored procedures to radius database from:
430setup/radius/OpenSER/radius_accounting.proc
431
4325.2.7
433alter table auth_user add column reseller bigint unsigned not null;
434
435CREATE TABLE `billing_enum_tlds` (
436  `id` bigint(20) unsigned NOT NULL auto_increment,
437  `gateway` varchar(50) NOT NULL default '',
438  `domain` varchar(50) NOT NULL default '',
439  `subscriber` varchar(50) NOT NULL default '',
440  `enum_tld` varchar(100) NOT NULL,
441  `e164_regexp` varchar(100) NOT NULL,
442  `discount` varchar(25) NOT NULL default '',
443  PRIMARY KEY  (`id`),
444  UNIQUE KEY `enum_idx` (`gateway`,`domain`,`subscriber`,`enum_tld`),
445  KEY `tld_idx` (`enum_tld`)
446);
447
448INSERT into billing_enum_tlds (enum_tld,e164_regexp,discount) values ('e164.example.com','([1-9][0-9]{7,})','25');
449
450alter table radius.radacctYYYMMDD change column FramedProtocol ENUMtld varchar(64) not NULL;
451
4525.4
453alter table prepaid_cards change column blocked blocked smallint unsigned not null;
454alter table prepaid_history change column value value decimal(10,4)  not null;
455alter table prepaid_history change column balance balance decimal(10,4)  not null;
456alter table auth_user change column reseller impersonate varchar(50) not null;
457
4586.2.3
459alter table cdrtool.billing_customers change column domain domain varchar(64) not null;
460alter table cdrtool.billing_customers change column subscriber subscriber varchar(128) not null;
461alter table cdrtool.billing_customers change column gateway gateway varchar(15) not null;
462
463alter table cdrtool.billing_profiles change column domain domain varchar(64) not null;
464alter table cdrtool.billing_profiles change column subscriber subscriber varchar(128) not null;
465alter table cdrtool.billing_profiles change column gateway gateway varchar(15) not null;
466
467alter table cdrtool.billing_rates change column domain domain varchar(64) not null;
468alter table cdrtool.billing_rates change column subscriber subscriber varchar(128) not null;
469alter table cdrtool.billing_rates change column gateway gateway varchar(15) not null;
470
471alter table cdrtool.billing_rates_history change column domain domain varchar(64) not null;
472alter table cdrtool.billing_rates_history change column subscriber subscriber varchar(128) not null;
473alter table cdrtool.billing_rates_history change column gateway gateway varchar(15) not null;
474
475alter table cdrtool.billing_enum_tlds change column domain domain varchar(64) not null;
476alter table cdrtool.billing_enum_tlds change column subscriber subscriber varchar(128) not null;
477alter table cdrtool.billing_enum_tlds change column gateway gateway varchar(15) not null;
478
479alter table cdrtool.billing_ratesNGN change column domain domain varchar(64) not null;
480alter table cdrtool.billing_ratesNGN change column subscriber subscriber varchar(128) not null;
481alter table cdrtool.billing_ratesNGN change column gateway gateway varchar(15) not null;
482
483alter table cdrtool.prepaid change column account account varchar(128) not null;
484
485optimize table billing_rates;
486optimize table billing_rates_history;
487optimize table billing_customers;
488optimize table billing_profiles;
489optimize table prepaid;
490
4916.3.3
492
493DROP TABLE IF EXISTS `quota_usage`;
494CREATE TABLE `quota_usage` (
495  `id` int(10) unsigned NOT NULL auto_increment,
496  `datasource` varchar(50) NOT NULL,
497  `account` varchar(128) NOT NULL default '',
498  `domain` varchar(64) default NULL,
499  `quota` int(11) unsigned NOT NULL,
500  `blocked` enum('0','1') NOT NULL default '0',
501  `notified` datetime NOT NULL,
502  `calls` int(10) unsigned NOT NULL,
503  `duration` bigint(20) unsigned NOT NULL,
504  `cost` decimal(10,4) NOT NULL,
505  `traffic` varchar(50) NOT NULL,
506  `change_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
507  PRIMARY KEY  (`id`),
508  UNIQUE KEY `account_idx` (`datasource`,`account`)
509);
510 
511alter table memcache change `value` `value` longblob not null;
512
513
5146.6.0
515
516alter table prepaid add column active_sessions text not null;
517alter table prepaid add column session_counter int unsigned not null;
518
519
5206.7.0
521alter table billing_rates drop column trafficRate;
522alter table cdrtool.billing_rates_history drop column trafficRate;
523
524alter table billing_rates_history modify application varchar(25)  not null default 'audio' after destination;
525alter table billing_rates modify application varchar(25)  not null default 'audio' after destination;
526
527alter table billing_rates_history modify connectCost varchar(25)  not null after application;
528alter table billing_rates modify connectCost varchar(25)  not null after application;
529
530alter table billing_rates add column connectCostIn varchar(25) not null;
531alter table billing_rates add column durationRateIn varchar(25) not null;
532
533alter table cdrtool.billing_rates_history add column connectCostIn varchar(25) not null after durationRate;
534alter table cdrtool.billing_rates_history add column durationRateIn varchar(25) not null after connectCostIn;
535alter table prepaid_history add column duration bigint unsigned not null after action;
536alter table prepaid_history add column session varchar(255) not null after duration;
537alter table prepaid_history add column destination varchar (15) not null after duration;
538alter table prepaid_history add index session_idx(session);
539
540alter table prepaid add column duration bigint(20) unsigned not null after destination;
541alter table prepaid add column domain varchar(128) not null after account;
542update prepaid set domain = SUBSTRING_INDEX(account, '@',-1);
543
5446.7.6
545alter table prepaid drop column call_lock;
546
5476.8.0
548alter table prepaid_history change column `number` `description` varchar(255) not null;
549alter table billing_rates add column increment smallint unsigned not null;
550alter table billing_rates add column min_duration smallint unsigned not null;
551alter table billing_rates_history add column increment smallint unsigned not null after durationRateIn;
552alter table billing_rates_history add column min_duration smallint unsigned not null after increment;
553
554alter table prepaid drop column call_lock;
555alter table prepaid drop column  call_in_progress;
556alter table prepaid add column reseller_id  int(10) unsigned not NULL after id;
557alter table prepaid add key reseller_idx (reseller_id);
558
559alter table prepaid_cards add column reseller_id  int(10) unsigned not NULL after id;
560alter table prepaid_cards add key reseller_idx (reseller_id);
561
562alter table prepaid_history add column reseller_id  int(10) unsigned not NULL after id;
563alter table prepaid_history add key reseller_idx (reseller_id);
564
565alter table quota_usage add column reseller_id  int(10) unsigned not NULL after id;
566alter table quota_usage add key reseller_idx (reseller_id);
567
568alter table billing_customers add column reseller_id  int(10) unsigned not NULL after id;
569alter table billing_customers add key reseller_idx (reseller_id);
570alter table billing_customers drop column country_code;
571
572alter table billing_profiles add column reseller_id  int(10) unsigned not NULL after id;
573alter table billing_profiles add key reseller_idx (reseller_id);
574
575alter table billing_rates add column reseller_id  int(10) unsigned not NULL after id;
576alter table billing_rates add key reseller_idx (reseller_id);
577
578alter table billing_rates_history add column reseller_id  int(10) unsigned not NULL after id;
579alter table billing_rates_history add key reseller_idx (reseller_id);
580
581alter table billing_enum_tlds add column reseller_id  int(10) unsigned not NULL after id;
582alter table billing_enum_tlds add key reseller_idx (reseller_id);
583
584alter table destinations add column reseller_id  int(10) unsigned not NULL after id;
585alter table destinations add key reseller_idx (reseller_id);
586
587alter table billing_profiles drop column gateway;
588alter table billing_profiles drop column subscriber;
589alter table billing_profiles drop column domain;
590
591alter table billing_rates drop column gateway;
592alter table billing_rates drop column subscriber;
593alter table billing_rates drop column domain;
594
595alter table billing_rates_history drop column gateway;
596alter table billing_rates_history drop column subscriber;
597alter table billing_rates_history drop column domain;
598
599alter table billing_enum_tlds drop column gateway;
600alter table billing_enum_tlds drop column subscriber;
601alter table billing_enum_tlds drop column domain;
602
603drop table billing_profilesNGN;
604drop table billing_ratesNGN;
605
606alter table log add column reseller_id  int(10) unsigned not NULL after id;
607alter table log add key reseller_idx (reseller_id);
608
609alter table destinations drop KEY `cust_dest_idx`;
610alter table destinations add KEY `cust_dest_idx` (`reseller_id`,`gateway`,`domain`,`subscriber`,`dest_id`);
611alter table prepaid_cards change column `value` `value` decimal(10,4) default 0;
612alter table billing_rates add column `maxPrice` varchar(25) NOT NULL default '';
613
614alter table prepaid drop column last_call_price;
615alter table prepaid drop column destination;
616alter table prepaid drop column duration;
617alter table prepaid drop column maxsessiontime;
618
619
6206.9.3
621alter table prepaid drop column domain;
622
6236.7.0
624alter table prepaid add column max_sessions int(10) unsigned not null default 1;
625
626alter table billing_enum_tlds drop KEY `enum_idx`;
627alter table billing_enum_tlds add UNIQUE `enum_idx` (`reseller_id`,`enum_tld`);
628
629alter table billing_rates drop KEY `rate_idx`;
630alter table billing_rates add UNIQUE `rate_idx` (`reseller_id`,`name`,`destination`,`application`);
631
632alter table billing_rates_history drop KEY `rate_idx`;
633alter table billing_rates_history add UNIQUE `rate_idx` (`reseller_id`,`name`,`destination`,`startDate`,`endDate`,`application`);
634
635alter table billing_profiles drop KEY `name_idx`;
636alter table billing_profiles add UNIQUE `name_idx` (`reseller_id`,`name`);
637
638alter table billing_rates drop column maxPrice;
639
640alter table billing_rates drop column min_duration;       
641alter table billing_rates drop column increment;           
642
643alter table billing_rates_history drop column min_duration;
644alter table billing_rates_history drop column increment;
645
646alter table billing_customers drop column min_duration;             
647alter table billing_customers drop column increment;             
648
649alter table destinations add column increment smallint unsigned not null;
650alter table destinations add column min_duration smallint unsigned not null;
651alter table destinations add column max_duration bigint unsigned  not null;
652alter table destinations add column max_price varchar(25) NOT NULL default '';
653
6547.1.1
655CREATE TABLE `subscriber_docs` (   
656  `id` int(11) NOT NULL auto_increment,
657  `username` varchar(64) NOT NULL,                           
658  `domain` varchar(64) NOT NULL,                 
659  `name` varchar(64) NOT NULL,                           
660  `document` varchar(64) NOT NULL,     
661  `file_content` mediumblob NOT NULL,
662  `file_name` varchar(255) NOT NULL default '',
663  `file_size` varchar(255) NOT NULL default '',
664  `file_type` varchar(255) NOT NULL default '',
665  `file_date` datetime NOT NULL default '0000-00-00 00:00:00',
666  `last_digits` varchar(64) NOT NULL,                           
667  `mobile_number` varchar(15) NOT NULL,
668  PRIMARY KEY  (`id`),
669  UNIQUE KEY `document_idx` (`username`,`domain`,`document`)     
670);
671
6728.0.0
673alter table destinations add column region varchar(50) not null after dest_id ;
674
675drop table if exists billing_discounts;
676CREATE TABLE `billing_discounts` (
677  `id` bigint(20) unsigned NOT NULL auto_increment,
678  `reseller_id` int(10) unsigned not NULL,
679  `gateway` varchar(50) NOT NULL default '',
680  `domain` varchar(50) NOT NULL default '',
681  `subscriber` varchar(50) NOT NULL default '',
682  `application` varchar(25) NOT NULL default '',
683  `destination` varchar(100) NOT NULL default '',
684  `region` varchar(25) NOT NULL default '',
685  `connect` smallint unsigned NOT NULL,
686  `duration` smallint unsigned NOT NULL,
687  PRIMARY KEY  (`id`),
688  UNIQUE KEY `rate_idx` (`gateway`,`domain`,`subscriber`,`destination`,`region`),
689  KEY `name_idx` (`region`),
690  KEY `dest_idx` (`destination`)
691) ;
692
693alter table quota_usage add column cost_today decimal(10,4) not null after cost;
694alter table log change column login login varchar(128)  not null;
695alter table billing_customers add column increment smallint unsigned not null;
696alter table billing_customers add column min_duration smallint unsigned not null;
697
Note: See TracBrowser for help on using the browser.