-- Revert gaia:doctor_2017_05_05_change_register_person from mysql

BEGIN;

ALTER TABLE `api_registerorganization_image` DROP FOREIGN KEY `doctor_id_refs_id_ae5213a5`;
ALTER TABLE `doctor_doctorregisterlicence` DROP FOREIGN KEY `doctor_register_id_refs_id_6e9b672f`;
ALTER TABLE `doctor_doctorregisterrecord` DROP FOREIGN KEY `doctor_register_id_refs_id_036272a4`;
ALTER TABLE `doctor_doctorregisteragreement` DROP FOREIGN KEY `doctor_register_id_refs_id_625f75eb`;

ALTER TABLE `doctor_doctorregister` DROP FOREIGN KEY `fk_api_person_ref_doctor_doctorregister`, MODIFY COLUMN `person_id` char(32);
ALTER TABLE `doctor_doctorregister` ADD CONSTRAINT `fk_api_person_ref_doctor_doctorregister` FOREIGN KEY (`person_id`) REFERENCES `api_person` (`id`);

ALTER TABLE `doctor_doctorregisteragreement` ADD CONSTRAINT `doctor_register_id_refs_id_625f75eb` FOREIGN KEY (`doctor_register_id`) REFERENCES `doctor_doctorregister` (`id`);
ALTER TABLE `doctor_doctorregisterrecord` ADD CONSTRAINT `doctor_register_id_refs_id_036272a4` FOREIGN KEY (`doctor_register_id`) REFERENCES `doctor_doctorregister` (`id`);
ALTER TABLE `doctor_doctorregisterlicence` ADD CONSTRAINT `doctor_register_id_refs_id_6e9b672f` FOREIGN KEY (`doctor_register_id`) REFERENCES `doctor_doctorregister` (`id`);
ALTER TABLE `api_registerorganization_image` ADD CONSTRAINT `doctor_id_refs_id_ae5213a5` FOREIGN KEY (`doctor_id`) REFERENCES `doctor_doctorregister` (`id`);

COMMIT;
