-- Deploy gaia:2017_05_31_answer_top to mysql

BEGIN;

CREATE TABLE `api_answer_top` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `question_id` integer,
    `answer_id` integer,
    `order` integer NOT NULL UNIQUE,
    `top_type` integer NOT NULL,
    `start_time` datetime(6),
    `end_time` datetime(6),
    `enable` bool NOT NULL,
    `create_time` datetime(6) NOT NULL
)
;
ALTER TABLE `api_answer_top` ADD CONSTRAINT `answer_id_refs_id_bfb3f2b2` FOREIGN KEY (`answer_id`) REFERENCES `api_answer` (`id`);
ALTER TABLE `api_answer_top` ADD CONSTRAINT `question_id_refs_id_e625d5a0` FOREIGN KEY (`question_id`) REFERENCES `api_question` (`id`);

COMMIT;
