-- Deploy gaia:api_2016_05_04_create_table_consulttheme to mysql

BEGIN;

CREATE TABLE `api_consult_theme` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `desc` varchar(128),
    `title` varchar(128),
    `image` varchar(256) NOT NULL,
    `is_online` bool NOT NULL
)
;
CREATE TABLE `api_consultthemewiki` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `consult_theme_id` integer NOT NULL,
    `slogan` varchar(128),
    `image` varchar(256) NOT NULL,
    `wiki_id` integer NOT NULL
)
;
ALTER TABLE `api_consultthemewiki` ADD CONSTRAINT `wiki_id_refs_id_07b098bb` FOREIGN KEY (`wiki_id`) REFERENCES `api_itemwiki` (`id`);
ALTER TABLE `api_consultthemewiki` ADD CONSTRAINT `consult_theme_id_refs_id_3a6c6616` FOREIGN KEY (`consult_theme_id`) REFERENCES `api_consult_theme` (`id`);

COMMIT;
