<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SQLPage nameConnection="">
<Statement><![CDATA[DROP TABLE IF EXISTS `e-comerce`.`account`;
CREATE TABLE  `e-comerce`.`account` (
  `fisrt_name` varchar(20) NOT NULL,
  `last_name` varchar(20) NOT NULL,
  `msisdn` varchar(15) NOT NULL,
  `address` varchar(30) NOT NULL,
  `payment_method` int(1) unsigned NOT NULL default '0',
  `country` varchar(20) NOT NULL,
  `city` varchar(20) NOT NULL,
  `e_mail` varchar(50) NOT NULL,
  `options` int(1) unsigned default '0',
  `age` int(1) unsigned default '0',
  PRIMARY KEY  (`msisdn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `e-comerce`.`customers`;
CREATE TABLE  `e-comerce`.`customers` (
  `account_id` decimal(10,0) unsigned NOT NULL,
  `customer_status` int(1) unsigned NOT NULL,
  `customer_type` varchar(45) NOT NULL,
  `last_transaction` int(10) unsigned NOT NULL,
  `creation_time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `last_action` timestamp NOT NULL default '0000-00-00 00:00:00',
  `user_group` varchar(45) NOT NULL,
  PRIMARY KEY  (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `e-comerce`.`payment_method`;
CREATE TABLE  `e-comerce`.`payment_method` (
  `payment_code` int(1) unsigned NOT NULL,
  `msisdn` varchar(45) NOT NULL,
  `payment_name` varchar(10) NOT NULL,
  `payment_connector` varchar(10) NOT NULL,
  `max_limit` decimal(10,0) unsigned NOT NULL,
  `low_limit` decimal(10,0) unsigned NOT NULL,
  PRIMARY KEY  (`msisdn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `e-comerce`.`payment_transaction`;
CREATE TABLE  `e-comerce`.`payment_transaction` (
  `customer_id` int(10) unsigned NOT NULL,
  `sequence` int(10) unsigned NOT NULL default '0',
  `transaction_status` int(1) unsigned NOT NULL,
  `pocket_id` varchar(45) NOT NULL,
  `start_time` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `end_time` varchar(45) NOT NULL,
  `transaction_amount` varchar(45) NOT NULL,
  PRIMARY KEY  (`sequence`,`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE VIEW `e-comerce`.`Inventory_Review` AS
select  inv.id, cat_1,short_name,locale ,category from 
inventory as inv,cathegory as cat,inventory_texts where
(cat_1=cat.id or cat_2=cat.id or cat_3=cat.id)  and inv.id=inventory_id

DROP TABLE IF EXISTS `e-comerce`.`transaction_history`;
CREATE TABLE  `e-comerce`.`transaction_history` (
  `customer_id` varchar(15) NOT NULL default ' ',
  `seq` int(10) unsigned NOT NULL,
  `transaction_status` int(10) unsigned NOT NULL,
  `pocket_id` int(10) unsigned NOT NULL,
  `start_time` varchar(45) NOT NULL,
  `end_time` varchar(45) NOT NULL,
  `transaction_amount` varchar(45) NOT NULL,
  PRIMARY KEY  (`customer_id`,`seq`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;]]></Statement>
</SQLPage>

