-- Deploy gaia:mark_2020_04_26_create_mark_push_table to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `mark_device_middle_id` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `middle_id` integer NOT NULL,
    `update_time` datetime(6) NOT NULL
);

CREATE TABLE `mark_gray_device` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `t_device_id` integer NOT NULL
);

CREATE TABLE `mark_middle_device` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `t_device_id` integer NOT NULL
);

CREATE TABLE `mark_push_log` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `is_effective` bool NOT NULL,
    `continuous_push_num` integer NOT NULL,
    `reset_num` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL
);

CREATE INDEX `mark_middle_device_df69bb19` ON `mark_middle_device` (`t_device_id`);
CREATE INDEX `mark_push_log_1ffdedc6` ON `mark_push_log` (`user_id`);

COMMIT;
