-- Deploy gaia:api_2015_11_15_add_tables_for_transaction_locks to mysql

BEGIN;

CREATE TABLE `api_cashbacklock` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `order_id` varchar(12) NOT NULL UNIQUE,
    `lock_at` datetime(6)
)
;
ALTER TABLE `api_cashbacklock` ADD CONSTRAINT `order_id_refs_id_764d13e0` FOREIGN KEY (`order_id`) REFERENCES `api_order` (`id`);
CREATE TABLE `api_refundlock` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `order_id` varchar(12) NOT NULL UNIQUE,
    `lock_at` datetime(6)
)
;
ALTER TABLE `api_refundlock` ADD CONSTRAINT `order_id_refs_id_f772e06b` FOREIGN KEY (`order_id`) REFERENCES `api_order` (`id`);

COMMIT;
