-- Deploy gaia:api_2016_05_04_create_table_consultscience to mysql

BEGIN;

CREATE TABLE `api_consult_science` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `desc` varchar(128),
    `image` varchar(256) NOT NULL,
    `is_online` bool NOT NULL,
    `wiki_id` integer NOT NULL UNIQUE
)
;
ALTER TABLE `api_consult_science` ADD CONSTRAINT `wiki_id_refs_id_b8adac7a` FOREIGN KEY (`wiki_id`) REFERENCES `api_itemwiki` (`id`);
CREATE TABLE `api_consultsciencewiki` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `consult_science_id` integer NOT NULL,
    `wiki_id` integer NOT NULL
)
;
ALTER TABLE `api_consultsciencewiki` ADD CONSTRAINT `consult_science_id_refs_id_005af8ca` FOREIGN KEY (`consult_science_id`) REFERENCES `api_consult_science` (`id`);
ALTER TABLE `api_consultsciencewiki` ADD CONSTRAINT `wiki_id_refs_id_e43bbfeb` FOREIGN KEY (`wiki_id`) REFERENCES `api_itemwiki` (`id`);

COMMIT;
