-- Deploy gaia:hippo_2018_04_16_add_doctor_resource_rank to mysql

BEGIN;

CREATE TABLE `doctor_service_rank` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `doctor_id` varchar(100) NOT NULL,
    `service_id` integer NOT NULL,
    `rank` integer NOT NULL,
    UNIQUE (`doctor_id`, `service_id`)
)
;
ALTER TABLE `doctor_service_rank` ADD CONSTRAINT `doctor_id_refs_id_f2768fe5` FOREIGN KEY (`doctor_id`) REFERENCES `api_doctor` (`id`);
CREATE TABLE `doctor_diary_rank` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `doctor_id` varchar(100) NOT NULL,
    `diary_id` integer NOT NULL,
    `rank` integer NOT NULL,
    UNIQUE (`doctor_id`, `diary_id`)
)
;
ALTER TABLE `doctor_diary_rank` ADD CONSTRAINT `doctor_id_refs_id_367b6180` FOREIGN KEY (`doctor_id`) REFERENCES `api_doctor` (`id`);

COMMIT;
