-- Deploy gaia:2018_07_13_add_coupon_distribution to mysql

BEGIN;

CREATE TABLE `api_coupondistribute` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(32) NOT NULL,
    `gift_id` integer NOT NULL,
    `background` varchar(256) NOT NULL,
    `enable` bool NOT NULL,
    `title` varchar(32) NOT NULL,
    `wechat` varchar(256) NOT NULL,
    `qq` varchar(256) NOT NULL,
    `weibo` varchar(256) NOT NULL,
    `share_image` varchar(255) NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL
)
;
ALTER TABLE `api_coupondistribute` ADD CONSTRAINT `gift_id_refs_id_b3c94c5a` FOREIGN KEY (`gift_id`) REFERENCES `api_channelgift` (`id`);
CREATE INDEX `api_coupondistribute_46862fea` ON `api_coupondistribute` (`gift_id`);

COMMIT;
