CREATE TABLE IF NOT EXISTS aots_contract_service_$mid (
  `id` uuid NOT NULL,
  `contract_id` int(11) NOT NULL,
  `contract_object_id` int(11) NOT NULL,
  `entity_module_id` int(11) NOT NULL,
  `entity_id` int(11) NOT NULL,
  `service_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `service_time` timestamp NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `cost` decimal(12,2) NOT NULL,
  `nds_rate` decimal(5,2) DEFAULT NULL,
  `service_sum` decimal(12,2) NOT NULL,
  `comment` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contract_object_service` (`contract_id`,`contract_object_id`,`service_id`) USING BTREE,
  KEY `time_service` (`service_time`,`service_id`) USING BTREE
);