-- Deploy gaia:api_20170329_alter_table_service to mysql

BEGIN;

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

CREATE TABLE `api_imagerelatedservice` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `service_id` integer NOT NULL,
    `image_url` varchar(255) NOT NULL
);
ALTER TABLE `api_imagerelatedservice` ADD CONSTRAINT `service_id_refs_id_a4d7e644` FOREIGN KEY (`service_id`) REFERENCES `api_service` (`id`);

CREATE TABLE `api_servicerelatedrecommendservice` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `service_id` integer NOT NULL,
    `recommend_service_id` integer NOT NULL
);
ALTER TABLE `api_servicerelatedrecommendservice` ADD CONSTRAINT `service_id_refs_id_5588ea82` FOREIGN KEY (`service_id`) REFERENCES `api_service` (`id`);
ALTER TABLE `api_servicerelatedrecommendservice` ADD CONSTRAINT `recommend_service_id_refs_id_5588ea82` FOREIGN KEY (`recommend_service_id`) REFERENCES `api_service` (`id`);

COMMIT;
