-- Deploy gaia:create_table_api_budan_ref_order to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `api_budan_ref_order` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `budan_id` varchar(12) NOT NULL DEFAULT '' COMMENT '补单ID',
  `service_id` int(11) NOT NULL COMMENT '美购ID',
  `service_name` varchar(100) NOT NULL DEFAULT '' COMMENT '美购名称',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gengmei_price` int(11) NOT NULL COMMENT '更美价格',
  `commission_rate` double(11,2) DEFAULT NULL COMMENT '佣金比例',
  `commission_amount` double(11,2) DEFAULT NULL COMMENT '更美抽成（默认按10%）',
  `additional_amount` double(11,2) DEFAULT NULL COMMENT '应补款',
  `order_id` varchar(12) NOT NULL DEFAULT '' COMMENT '订单ID',
  PRIMARY KEY (`id`),
  KEY `budan_id` (`budan_id`),
  KEY `service_id` (`service_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4;

COMMIT;
