-- Revert gaia:api_2016_09_12_create_table_optimizewiki from mysql

BEGIN;

DROP TABLE `api_tagwiki`;
DROP TABLE `api_wikistruct`;
DROP TABLE `api_wikidetailadver`;
DROP TABLE `api_connectwiki`;
DROP TABLE `api_optimizewiki`;


ALTER TABLE `api_itemwiki`
DROP COLUMN `ache_level`,
DROP COLUMN `anesthesia_type`,
DROP COLUMN `show_diary`,
DROP COLUMN `show_service`,
DROP COLUMN `show_zone`;



ALTER TABLE `api_wikiadver` DROP FOREIGN KEY `itemwiki_id_refs_id_062dac9f`;
ALTER TABLE `api_wikiadver` DROP COLUMN `itemwiki_id`;

ALTER TABLE `api_wikiadver` DROP FOREIGN KEY `tag_id_refs_id_e7b12d23`;
ALTER TABLE `api_wikiadver` MODIFY `tag_id` integer NOT NULL;
ALTER TABLE `api_wikiadver` ADD CONSTRAINT `tag_id_refs_id_e7b12d23` FOREIGN KEY (`tag_id`) REFERENCES `api_tag` (`id`);
ALTER TABLE `api_wikiadver` DROP COLUMN `is_online`;

COMMIT;
