-- Deploy gaia:api_20170329_alter_table_serviceregister to mysql

BEGIN;

ALTER TABLE `api_serviceregister` ADD COLUMN `image_bigpic` varchar(300);
ALTER TABLE `api_serviceregister` ADD COLUMN `have_extra_pay` bool DEFAULT FALSE;
ALTER TABLE `api_serviceregister` ADD COLUMN `extra_pay_info` longtext;

CREATE TABLE `api_imagerelatedserviceregister` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `serviceregister_id` integer NOT NULL,
    `image_url` varchar(255) NOT NULL
);
ALTER TABLE `api_imagerelatedserviceregister` ADD CONSTRAINT `serviceregister_id_refs_id_90887aa7` FOREIGN KEY (`serviceregister_id`) REFERENCES `api_serviceregister` (`id`);

CREATE TABLE `api_serviceregisterrelatedrecommendservice` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `serviceregister_id` integer NOT NULL,
    `recommend_service_id` integer NOT NULL
);
ALTER TABLE `api_serviceregisterrelatedrecommendservice` ADD CONSTRAINT `recommend_service_id_refs_id_69cc3d93` FOREIGN KEY (`recommend_service_id`) REFERENCES `api_service` (`id`);
ALTER TABLE `api_serviceregisterrelatedrecommendservice` ADD CONSTRAINT `serviceregister_id_refs_id_0096bc2b` FOREIGN KEY (`serviceregister_id`) REFERENCES `api_serviceregister` (`id`);

COMMIT;
