-- Deploy gaia:2018_09_04_create_new_wiki_tag to mysql

BEGIN;

CREATE TABLE `wiki_collect_tag` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `collect_id` integer NOT NULL,
    `tag_id` integer NOT NULL
)
;
ALTER TABLE `wiki_collect_tag` ADD CONSTRAINT `tag_id_refs_id_2daff2f7` FOREIGN KEY (`tag_id`) REFERENCES `api_tag` (`id`);
ALTER TABLE `wiki_collect_tag` ADD CONSTRAINT `collect_id_refs_id_bf39362f` FOREIGN KEY (`collect_id`) REFERENCES `wiki_collect` (`id`);


CREATE TABLE `wiki_item_tag` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `item_id` integer NOT NULL,
    `tag_id` integer NOT NULL
)
;
ALTER TABLE `wiki_item_tag` ADD CONSTRAINT `tag_id_refs_id_cd6a9842` FOREIGN KEY (`tag_id`) REFERENCES `api_tag` (`id`);
ALTER TABLE `wiki_item_tag` ADD CONSTRAINT `item_id_refs_id_04e822a3` FOREIGN KEY (`item_id`) REFERENCES `wiki_item` (`id`);

COMMIT;
