-- Deploy gaia:wiki_2020_03_02_create_table_wiki_relation_tag_v3 to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `wiki_brand_tag_v3` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `brand_id` integer NOT NULL,
    `tag_v3_id` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL
);

CREATE TABLE `wiki_product_tag_v3` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `product_id` integer NOT NULL,
    `tag_v3_id` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL
);

CREATE TABLE `wiki_item_tag_v3` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `item_id` integer NOT NULL,
    `tag_v3_id` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL
);

CREATE TABLE `wiki_collect_tag_v3` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `collect_id` integer NOT NULL,
    `tag_v3_id` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL
);

CREATE INDEX `wiki_brand_tag_v3_6a59efff` ON `wiki_brand_tag_v3` (`brand_id`);
CREATE INDEX `wiki_brand_tag_v3_eb20a4b7` ON `wiki_brand_tag_v3` (`tag_v3_id`);

CREATE INDEX `wiki_product_tag_v3_10a0e6a0` ON `wiki_product_tag_v3` (`product_id`);
CREATE INDEX `wiki_product_tag_v3_eb20a4b7` ON `wiki_product_tag_v3` (`tag_v3_id`);

CREATE INDEX `wiki_item_tag_v3_40877d7e` ON `wiki_item_tag_v3` (`item_id`);
CREATE INDEX `wiki_item_tag_v3_eb20a4b7` ON `wiki_item_tag_v3` (`tag_v3_id`);

CREATE INDEX `wiki_collect_tag_v3_8c0caec3` ON `wiki_collect_tag_v3` (`collect_id`);
CREATE INDEX `wiki_collect_tag_v3_eb20a4b7` ON `wiki_collect_tag_v3` (`tag_v3_id`);

COMMIT;
