-- Deploy gaia:doctor_2016_03_16_create_tables_for_mars to mysql

BEGIN;

CREATE TABLE `doctor_saledetail` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `doctor_id` varchar(100) NOT NULL,
    `date` date NOT NULL,
    `order_total` integer NOT NULL,
    `validated_total` integer NOT NULL,
    `refund_total` integer NOT NULL,
    `service_infos` longtext NOT NULL
)
;
ALTER TABLE `doctor_saledetail` ADD CONSTRAINT `doctor_id_refs_id_2dabd2fa` FOREIGN KEY (`doctor_id`) REFERENCES `api_doctor` (`id`);

CREATE TABLE `doctor_workreport` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `doctor_id` varchar(100) NOT NULL,
    `date` date NOT NULL,
    `msg_received` integer NOT NULL,
    `msg_sended` integer NOT NULL,
    `replied` integer NOT NULL,
    `best_replied` integer NOT NULL,
    `service_saled_users` integer NOT NULL,
    `service_saled_money` double precision NOT NULL,
    `service_validated_users` integer NOT NULL,
    `service_validated_money` double precision NOT NULL,
    `diary_created` integer NOT NULL,
    `diary_updated` integer NOT NULL,
    `diary_replied` integer NOT NULL,
    `diary_voted` integer NOT NULL,
    `diary_home` integer NOT NULL,
    `reservation_accepted` integer NOT NULL
)
;
ALTER TABLE `doctor_workreport` ADD CONSTRAINT `doctor_id_refs_id_407770ac` FOREIGN KEY (`doctor_id`) REFERENCES `api_doctor` (`id`);

COMMIT;
