-- Deploy gaia:hippo_20171120_add_doctormessage to mysql

BEGIN;

CREATE TABLE `hippo_doctormessage` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `type` integer NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `info_id` varchar(100) NOT NULL,
    `doctor_id` varchar(100),
    `merchant_id` bigint,
    `content` varchar(200),
    `is_read` bool NOT NULL
);
ALTER TABLE `hippo_doctormessage` ADD CONSTRAINT `merchant_id_refs_id_1851feac` FOREIGN KEY (`merchant_id`) REFERENCES `hippo_merchant` (`id`);
ALTER TABLE `hippo_doctormessage` ADD CONSTRAINT `doctor_id_refs_id_c8baec9c` FOREIGN KEY (`doctor_id`) REFERENCES `api_doctor` (`id`);
CREATE TABLE `hippo_ordermessage` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `type` integer NOT NULL,
    `info_id` varchar(100) NOT NULL,
    `doctor_id` varchar(100),
    `merchant_id` bigint,
    `created_time` datetime(6) NOT NULL,
    `is_push` bool NOT NULL
);
ALTER TABLE `hippo_ordermessage` ADD CONSTRAINT `merchant_id_refs_id_d80c1733` FOREIGN KEY (`merchant_id`) REFERENCES `hippo_merchant` (`id`);
ALTER TABLE `hippo_ordermessage` ADD CONSTRAINT `doctor_id_refs_id_856bc198` FOREIGN KEY (`doctor_id`) REFERENCES `api_doctor` (`id`);

COMMIT;
