-- Deploy gaia:kyc4-opt to mysql

BEGIN;

CREATE TABLE `api_questionnaire_answer_relation_attrtag` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `attr_tag_id` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL
);

ALTER TABLE `api_questionnaire_answer_relation_attrtag` ADD COLUMN `questionnaire_answer_id` integer NOT NULL;
CREATE INDEX `api_questionnaire_answer_relation_attrtag_551fe27a` ON `api_questionnaire_answer_relation_attrtag` (`attr_tag_id`);
CREATE INDEX `api_questionnaire_answer_relation_attrtag_91c1d6ea` ON `api_questionnaire_answer_relation_attrtag` (`questionnaire_answer_id`);

ALTER TABLE `api_questionnaire_qa_sub_relations` ADD COLUMN `is_series_answer` bool DEFAULT 0 NOT NULL;
ALTER TABLE `api_questionnaire_answer` ADD COLUMN `questionnaire_display_content` varchar(128);

ALTER TABLE `api_questionnaire_questions` ADD COLUMN `portrait_type` integer DEFAULT 1 NOT NULL;

ALTER TABLE `api_tag_attr` ADD COLUMN `is_using_ai` varchar(1024) DEFAULT 0 NOT NULL;

COMMIT;
