CREATE TABLE IF NOT EXISTS `mobi_transaction_$mid` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `contract_id` int(11) NOT NULL,
  `summ` decimal(10,0) NOT NULL,
  `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `end_date` timestamp NULL DEFAULT NULL,
  `status` int(11) NOT NULL,
  `mobi_payment_id` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `mobi_service_code_$mid` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
);

ALTER TABLE `mobi_transaction_$mid` CHANGE COLUMN contract_id cid INTEGER  NOT NULL;