-- Deploy gaia:api_2016_06_02_create_table_pay_applepay to mysql

BEGIN;

CREATE TABLE `pay_applepayrefund` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`order_no` varchar(12) NOT NULL,
`oid_partner` varchar(18) NOT NULL,
`oid_refundno` varchar(16) NOT NULL,
`money_refund` double precision NOT NULL,
`no_refund` varchar(32) NOT NULL,
`dt_refund` datetime(6) NOT NULL,
`sta_refund` varchar(1) NOT NULL,
`settle_date` datetime(6) NOT NULL
);
CREATE TABLE `pay_applepaysettlement` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`settlement_id` varchar(12) NOT NULL,
`oid_partner` varchar(18) NOT NULL,
`dt_order` datetime(6) NOT NULL,
`created_time` datetime(6) NOT NULL,
`oid_paybill` varchar(16) NOT NULL,
`money_order` double precision NOT NULL
);
ALTER TABLE `pay_applepaysettlement` ADD CONSTRAINT `settlement_id_refs_id_d8176b32` FOREIGN KEY (`settlement_id`) REFERENCES `api_settlement` (`id`);

COMMIT;
