-- Deploy gaia:api_2017_5_5_create_table_api_user_question_answer to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `api_user_question_answer` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `answer_id` integer,
    `question_id` integer,
    `create_time` datetime(6) NOT NULL
)
;
ALTER TABLE `api_user_question_answer` ADD CONSTRAINT `user_id_refs_id_6a1b3b8b` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `api_user_question_answer` ADD CONSTRAINT `answer_id_refs_id_f8875a89` FOREIGN KEY (`answer_id`) REFERENCES `api_answer` (`id`);
ALTER TABLE `api_user_question_answer` ADD CONSTRAINT `question_id_refs_id_93b54395` FOREIGN KEY (`question_id`) REFERENCES `api_question` (`id`);
CREATE INDEX `api_user_question_answer_6340c63c` ON `api_user_question_answer` (`user_id`);
CREATE INDEX `api_user_question_answer_5b4ce3ea` ON `api_user_question_answer` (`answer_id`);
CREATE INDEX `api_user_question_answer_25110688` ON `api_user_question_answer` (`question_id`);

COMMIT;
