-- Deploy gaia:2019_10_08_add_column_is_online to mysql

BEGIN;


ALTER TABLE `api_special` ADD COLUMN `polymer_unselected_image` varchar(255) DEFAULT '';
ALTER TABLE `api_special` ADD COLUMN `activity_rules` longtext NULL;

ALTER TABLE `api_seckillpolymer` ADD COLUMN `rules` longtext NULL;
ALTER TABLE `api_seckillpolymer` ADD COLUMN `is_online` bool DEFAULT 0;
ALTER TABLE `api_seckillpolymer` ADD COLUMN `create_time` datetime(6) NOT NULL;
ALTER TABLE `api_seckillpolymer` ADD COLUMN `update_time` datetime(6) NOT NULL;
ALTER TABLE `api_seckillpolymer` modify COLUMN `tool_bar_json` longtext NULL;

CREATE TABLE `api_seckillpolymerlayout` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `seckill_polymer_id` integer NOT NULL,
    `is_visible` bool NOT NULL DEFAULT 0,
    `module` integer NOT NULL,
    `related` longtext NULL,
    UNIQUE (`seckill_polymer_id`, `module`)
)
;
ALTER TABLE `api_seckillpolymerlayout` ADD CONSTRAINT `seckill_polymer_id_refs_id_41010553` FOREIGN KEY (`seckill_polymer_id`) REFERENCES `api_seckillpolymer` (`id`);
CREATE INDEX `api_seckillpolymerlayout_a1aef665` ON `api_seckillpolymerlayout` (`seckill_polymer_id`);

COMMIT;
