-- Deploy gaia:2020_02_05_create_launch_serviceconfigurerelevant to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `launch_serviceconfigurerelevant` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `title` varchar(128) NOT NULL,
    `user_type` integer NOT NULL,
    `start_time` datetime(6),
    `end_time` datetime(6),
    `special_id` integer,
    `event_type` integer,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL
)
;
ALTER TABLE `launch_serviceconfigurerelevant` ADD CONSTRAINT `special_id_refs_id_47a0ac54` FOREIGN KEY (`special_id`) REFERENCES `api_special` (`id`);
CREATE INDEX `launch_serviceconfigurerelevant_57902095` ON `launch_serviceconfigurerelevant` (`special_id`);
CREATE INDEX `launch_serviceconfigurerelevant_3120f0b2` ON `launch_serviceconfigurerelevant` (`event_type`);

CREATE TABLE `launch_serviceconfigurerelationcity` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `city_id` varchar(40) NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `service_configure_relevant_id` integer NOT NULL
)
;
ALTER TABLE `launch_serviceconfigurerelationcity` ADD CONSTRAINT `service_configure_relevant_id_refs_id_2a3bf290` FOREIGN KEY (`service_configure_relevant_id`) REFERENCES `launch_serviceconfigurerelevant` (`id`);
ALTER TABLE `launch_serviceconfigurerelationcity` ADD CONSTRAINT `city_id_refs_id_b52a448a` FOREIGN KEY (`city_id`) REFERENCES `api_city` (`id`);
CREATE INDEX `launch_serviceconfigurerelationcity_b376980e` ON `launch_serviceconfigurerelationcity` (`city_id`);
CREATE INDEX `launch_serviceconfigurerelationcity_3b26ae06` ON `launch_serviceconfigurerelationcity` (`service_configure_relevant_id`);

CREATE TABLE `launch_serviceconfigurerelationregion` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `region_id` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `service_configure_relevant_id` integer NOT NULL
)
;
ALTER TABLE `launch_serviceconfigurerelationregion` ADD CONSTRAINT `service_configure_relevant_id_refs_id_7aaa5879` FOREIGN KEY (`service_configure_relevant_id`) REFERENCES `launch_serviceconfigurerelevant` (`id`);
ALTER TABLE `launch_serviceconfigurerelationregion` ADD CONSTRAINT `region_id_refs_id_2acf75ae` FOREIGN KEY (`region_id`) REFERENCES `api_region` (`id`);
CREATE INDEX `launch_serviceconfigurerelationregion_55a4ce96` ON `launch_serviceconfigurerelationregion` (`region_id`);
CREATE INDEX `launch_serviceconfigurerelationregion_3b26ae06` ON `launch_serviceconfigurerelationregion` (`service_configure_relevant_id`);


COMMIT;
