SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE IF NOT EXISTS `t_ticket_calculation`  (
  `calculation_id` int(11) NOT NULL AUTO_INCREMENT,
  `data_id` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `affair_id` int(11) NOT NULL,
  `tagIds` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `calculation_condition` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
  `calculation_key` varchar(13) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `calculation_time` datetime(0) NOT NULL ,
  `calculation_value` decimal(22, 6) NOT NULL DEFAULT 0.000000 ,
  `call_time` datetime(0) NOT NULL,
  `calculation_note` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `ticket_key` varchar(13) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `ticket_time` datetime(0) NOT NULL ,
  PRIMARY KEY (`calculation_id`, `data_id`) USING BTREE,
  INDEX `call_time`(`call_time`) USING BTREE,
  INDEX ` calculation_value`(`affair_id`, `calculation_key`, `calculation_condition`, `calculation_time`, `tagIds`, `ticket_key`, `ticket_time`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS=1;