-- Deploy gaia:2018_07_04_doctor_rank_factor to mysql

BEGIN;
CREATE TABLE `statistic_doctor_rank_factor` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `doctor_id` varchar(100) NOT NULL, `partition_date` varchar(8) NOT NULL, `expert_pv_30` integer NOT NULL, `expert_message_num_30` double precision NOT NULL, `expert_exposure_pv_30` integer NOT NULL);
CREATE TABLE `statistic_merchant_rank_factor` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `merchant_id` varchar(100) NOT NULL, `partition_date` varchar(8) NOT NULL, `doctor_ad_money_30_days` double precision NOT NULL, `doctor_discount_30_days` double precision NOT NULL, `service_pv_30` integer NOT NULL, `expert_pv_30` integer NOT NULL, `organization_pv_30` integer NOT NULL);
ALTER TABLE `statistic_merchant_rank_factor` ADD CONSTRAINT `statistic_merchant_rank_factor_merchant_id_47aae547fbb44ad8_uniq` UNIQUE (`merchant_id`, `partition_date`);
ALTER TABLE `statistic_doctor_rank_factor` ADD CONSTRAINT `statistic_doctor_rank_factor_doctor_id_5278fa6fc3f236a2_uniq` UNIQUE (`doctor_id`, `partition_date`);

COMMIT;