-- Deploy mimas-talos:talos_2020_03_02_create_table_relation_tag_v3 to mysql

BEGIN;

-- XXX Add DDLs here.

CREATE TABLE `api_diary_tag_v3` (
	`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
	`diary_id` integer NOT NULL,
	`tag_v3_id` integer NOT NULL
);

CREATE TABLE `api_problem_tag_v3` (
	`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
	`problem_id` integer NOT NULL,
	`tag_v3_id` integer NOT NULL
);

CREATE TABLE `api_tractate_tag_v3` (
	`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
	`tractate_id` integer NOT NULL,
	`tag_v3_id` integer NOT NULL
);

CREATE INDEX `api_diary_tag_v3_52d39f23` ON `api_diary_tag_v3` (`diary_id`);
CREATE INDEX `api_diary_tag_v3_f08f66f7` ON `api_diary_tag_v3` (`tag_v3_id`);

CREATE INDEX `api_problem_tag_v3_919b1d80` ON `api_problem_tag_v3` (`problem_id`);
CREATE INDEX `api_problem_tag_v3_f08f66f7` ON `api_problem_tag_v3` (`tag_v3_id`);

CREATE INDEX `api_tractate_tag_v3_5f3745c8` ON `api_tractate_tag_v3` (`tractate_id`);
CREATE INDEX `api_tractate_tag_v3_f08f66f7` ON `api_tractate_tag_v3` (`tag_v3_id`);

COMMIT;
