-- Deploy gaia:2017_12_18_alter_greetingpopup to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `api_greetingpopup_regions` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `greetingpopup_id` integer NOT NULL,
    `region_id` integer NOT NULL,
    UNIQUE (`greetingpopup_id`, `region_id`)
)
;
ALTER TABLE `api_greetingpopup_regions` ADD CONSTRAINT `region_id_refs_id_ac815b92` FOREIGN KEY (`region_id`) REFERENCES `api_region` (`id`);
CREATE TABLE `api_greetingpopup_cities` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `greetingpopup_id` integer NOT NULL,
    `city_id` varchar(40) NOT NULL,
    UNIQUE (`greetingpopup_id`, `city_id`)
)
;
ALTER TABLE `api_greetingpopup_cities` ADD CONSTRAINT `city_id_refs_id_684559fb` FOREIGN KEY (`city_id`) REFERENCES `api_city` (`id`);
ALTER TABLE `api_greetingpopup_regions` ADD CONSTRAINT `greetingpopup_id_refs_id_dc6ba3a1` FOREIGN KEY (`greetingpopup_id`) REFERENCES `api_greetingpopup` (`id`);
ALTER TABLE `api_greetingpopup_cities` ADD CONSTRAINT `greetingpopup_id_refs_id_ab18b1bf` FOREIGN KEY (`greetingpopup_id`) REFERENCES `api_greetingpopup` (`id`);

COMMIT;
