-- Deploy gaia:category_2020_03_02_create_table_category_relation_tag_v3 to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `category_element_tag_v3` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `is_online` bool NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL,
    `is_deleted` bool NOT NULL,
    `element_id` integer NOT NULL,
    `tag_v3_id` integer NOT NULL
);

CREATE TABLE `category_polymer_tag_v3` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `is_online` bool NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL,
    `is_deleted` bool NOT NULL,
    `category_id` integer NOT NULL,
    `tag_v3_id` integer NOT NULL
);

CREATE INDEX `category_element_tag_v3_c3bd43a2` ON `category_element_tag_v3` (`update_time`);
CREATE INDEX `category_element_tag_v3_6540c3a7` ON `category_element_tag_v3` (`element_id`);
CREATE INDEX `category_element_tag_v3_eb20a4b7` ON `category_element_tag_v3` (`tag_v3_id`);

CREATE INDEX `category_polymer_tag_v3_c3bd43a2` ON `category_polymer_tag_v3` (`update_time`);
CREATE INDEX `category_polymer_tag_v3_ee3b5834` ON `category_polymer_tag_v3` (`category_id`);
CREATE INDEX `category_polymer_tag_v3_eb20a4b7` ON `category_polymer_tag_v3` (`tag_v3_id`);

COMMIT;
