 	PRIMARY KEY  (id)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
-ALTER TABLE `cc_call_archive` ADD INDEX ( `username` );
-ALTER TABLE `cc_call_archive` ADD INDEX ( `starttime` );
-ALTER TABLE `cc_call_archive` ADD INDEX ( `terminatecause` );
-ALTER TABLE `cc_call_archive` ADD INDEX ( `calledstation` );
+ALTER TABLE cc_call_archive ADD INDEX ( username );
+ALTER TABLE cc_call_archive ADD INDEX ( starttime );
+ALTER TABLE cc_call_archive ADD INDEX ( terminatecause );
+ALTER TABLE cc_call_archive ADD INDEX ( calledstation );
 
 
 




ALTER TABLE cc_card_archive DROP COLUMN  `callback`;
-- already present ALTER TABLE cc_card_archive ADD COLUMN  `id_timezone` int(11) default '0';
ALTER TABLE cc_card_archive ADD COLUMN  `voicemail_permitted` int(11) NOT NULL default '0';
ALTER TABLE cc_card_archive ADD COLUMN  `voicemail_activated` smallint(6) NOT NULL default '0';
ALTER TABLE cc_card_archive ADD COLUMN  `last_notification` timestamp NULL default NULL;
ALTER TABLE cc_card_archive ADD COLUMN  `email_notification` char(70) collate utf8_bin default NULL;
ALTER TABLE cc_card_archive ADD COLUMN  `notify_email` smallint(6) NOT NULL default '0';
ALTER TABLE cc_card_archive ADD COLUMN  `credit_notification` int(11) NOT NULL default '-1';
ALTER TABLE cc_card_archive ADD COLUMN  `id_group` int(11) NOT NULL default '1';
ALTER TABLE cc_card_archive ADD COLUMN  `company_name` varchar(50) collate utf8_bin default NULL;
ALTER TABLE cc_card_archive ADD COLUMN  `company_website` varchar(60) collate utf8_bin default NULL;
ALTER TABLE cc_card_archive ADD COLUMN  `VAT_RN` varchar(40) collate utf8_bin default NULL;
ALTER TABLE cc_card_archive ADD COLUMN  `traffic` bigint(20) default NULL;
ALTER TABLE cc_card_archive ADD COLUMN  `traffic_target` mediumtext collate utf8_bin;
ALTER TABLE cc_card_archive ADD COLUMN  `discount` decimal(5,2) NOT NULL default '0.00';
ALTER TABLE cc_card_archive ADD COLUMN  `restriction` tinyint(4) NOT NULL default '0';
ALTER TABLE cc_card_archive DROP COLUMN `template_invoice`;
ALTER TABLE cc_card_archive DROP COLUMN `template_outstanding`;
ALTER TABLE cc_card_archive DROP COLUMN `mac_addr`;
ALTER TABLE cc_card_archive ADD COLUMN `mac_addr` char(17) collate utf8_bin NOT NULL default '00-00-00-00-00-00';

CREATE TABLE cc_billing_customer (
	id BIGINT NOT NULL AUTO_INCREMENT,

	`status` int(11) NOT NULL default '0',
	cvv varchar(4) collate utf8_bin default NULL,
	credit_card_type varchar(20) collate utf8_bin default NULL,
	currency varchar(4) collate utf8_bin default NULL,
	transaction_detail longtext collate utf8_bin,
	PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

ALTER TABLE cc_epayment_log CHANGE id id BIGINT NOT NULL AUTO_INCREMENT ,
	CHANGE cardid cardid BIGINT NOT NULL DEFAULT '0',
	CHANGE amount amount DECIMAL( 15, 5 ) NOT NULL DEFAULT '0';

ALTER TABLE cc_payments CHANGE id id BIGINT NOT NULL AUTO_INCREMENT ,
	CHANGE customers_id customers_id BIGINT NOT NULL DEFAULT '0';

CREATE TABLE cc_payments_agent (
	id BIGINT NOT NULL auto_increment,
	agent_id BIGINT collate utf8_bin NOT NULL,
	agent_name varchar(200) collate utf8_bin NOT NULL,
	agent_email_address varchar(96) collate utf8_bin NOT NULL,
	item_name varchar(127) collate utf8_bin default NULL,
	item_id varchar(127) collate utf8_bin default NULL,
	item_quantity int(11) NOT NULL default '0',
	payment_method varchar(32) collate utf8_bin NOT NULL,
	cc_type varchar(20) collate utf8_bin default NULL,
	cc_owner varchar(64) collate utf8_bin default NULL,
	cc_number varchar(32) collate utf8_bin default NULL,
	cc_expires varchar(4) collate utf8_bin default NULL,
	orders_status int(5) NOT NULL,
	orders_amount decimal(14,6) default NULL,
	last_modified datetime default NULL,
	date_purchased datetime default NULL,
	orders_date_finished datetime default NULL,
	currency char(3) collate utf8_bin default NULL,
	currency_value decimal(14,6) default NULL,
	PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;


ALTER TABLE cc_agent_commission ADD id_agent INT NOT NULL ;

-- remove reseller field from logpayment & log refill
ALTER TABLE cc_logpayment DROP reseller_id; 
ALTER TABLE cc_logrefill DROP reseller_id;


