-- Deploy gaia:2019_11_19_add_seckillpolymerbutton to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `api_seckillpolymerbutton` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `seckill_polymer_id` integer NOT NULL,
    `selected_image` varchar(255) NOT NULL,
    `unselected_image` varchar(255) NOT NULL,
    `special_id` integer NOT NULL,
    `module` integer NOT NULL
)
;
ALTER TABLE `api_seckillpolymerbutton` ADD CONSTRAINT `special_id_refs_id_fbd9af3b` FOREIGN KEY (`special_id`) REFERENCES `api_special` (`id`);
ALTER TABLE `api_seckillpolymerbutton` ADD CONSTRAINT `seckill_polymer_id_refs_id_9221160f` FOREIGN KEY (`seckill_polymer_id`) REFERENCES `api_seckillpolymer` (`id`);
CREATE INDEX `api_seckillpolymerbutton_a1aef665` ON `api_seckillpolymerbutton` (`seckill_polymer_id`);
CREATE INDEX `api_seckillpolymerbutton_57902095` ON `api_seckillpolymerbutton` (`special_id`);

CREATE TABLE `api_specialregion` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `region_id` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `special_id` integer NOT NULL
)
;
ALTER TABLE `api_specialregion` ADD CONSTRAINT `region_id_refs_id_de6a7050` FOREIGN KEY (`region_id`) REFERENCES `api_region` (`id`);
ALTER TABLE `api_specialregion` ADD CONSTRAINT `special_id_refs_id_7bd36f64` FOREIGN KEY (`special_id`) REFERENCES `api_special` (`id`);
CREATE INDEX `api_specialregion_55a4ce96` ON `api_specialregion` (`region_id`);
CREATE INDEX `api_specialregion_57902095` ON `api_specialregion` (`special_id`);

alter table api_seckillpolymer add column polymer_type varchar(3) NOT NULL DEFAULT '41';
alter table api_seckillpolymer add column button_selection varchar(3) DEFAULT '0';

alter table api_greetingpopup add column aggregation_id int(11) DEFAULT NULL;
alter table api_specialexterior add column aggregate_type int(3) DEFAULT 1;

COMMIT;
