-- Deploy gaia:statistic_2017_12_22_create_table_statistic_promotion_channel to mysql

BEGIN;

CREATE TABLE `statistic_promotion_channel` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `appid` varchar(64) NOT NULL,
    `idfa` varchar(64) NOT NULL,
    `client_type` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL,
    `active_time` datetime(6) NULL,
    `callback_type` varchar(2) NOT NULL,
    `callback` varchar(1024) NOT NULL,
    `click_request` longtext NOT NULL,
    `callback_response` longtext NOT NULL,
    `active_key` varchar(1024) NOT NULL,
    `record_from` varchar(128) NOT NULL
    );

ALTER TABLE `statistic_promotion_channel` ADD CONSTRAINT `statistic_promotion_channel_idfa_3444ae36611a37ac_uniq` UNIQUE (`idfa`, `appid`);

COMMIT;
