-- Deploy gaia:api_2018_07_12_add_related_fields to mysql

BEGIN;

CREATE TABLE `polymer_polymercontent_cities` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `polymercontent_id` integer NOT NULL,
    `city_id` varchar(40) NOT NULL,
    UNIQUE (`polymercontent_id`, `city_id`)
)
;
ALTER TABLE `polymer_polymercontent_cities` ADD CONSTRAINT `city_id_refs_id_d08aaef0` FOREIGN KEY (`city_id`) REFERENCES `api_city` (`id`);
ALTER TABLE `polymer_polymercontent_cities` ADD CONSTRAINT `polymercontent_id_refs_id_3bb5985a` FOREIGN KEY (`polymercontent_id`) REFERENCES `polymer_polymercontent` (`id`);


ALTER TABLE `polymer_polymercontent` ADD COLUMN `start_time` datetime(6);
ALTER TABLE `polymer_polymercontent` ADD COLUMN `end_time` datetime(6);
ALTER TABLE `polymer_polymercontent` ADD COLUMN `is_online` bool DEFAULT True;
ALTER TABLE `polymer_polymercontent` ADD COLUMN `is_related_city` bool DEFAULT FALSE ;


COMMIT;
