-- Deploy gaia:api_2016_07_04_create_DoctorBusinessRecord to mysql

BEGIN;

CREATE TABLE `api_docbusinessrecord` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `doctor_id` varchar(100) NOT NULL,
    `business_id` integer,
    `to_business_id` integer,
    `user_id` integer,
    `action_time` datetime(6) NOT NULL
)
;
ALTER TABLE `api_docbusinessrecord` ADD CONSTRAINT `business_id_refs_id_15399fb6` FOREIGN KEY (`business_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `api_docbusinessrecord` ADD CONSTRAINT `to_business_id_refs_id_15399fb6` FOREIGN KEY (`to_business_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `api_docbusinessrecord` ADD CONSTRAINT `user_id_refs_id_15399fb6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `api_docbusinessrecord` ADD CONSTRAINT `doctor_id_refs_id_f3421e54` FOREIGN KEY (`doctor_id`) REFERENCES `api_doctor` (`id`);
COMMIT;
