-- Deploy gaia:gaia_2019_01_11_add_table_about_new_spring to mysql

BEGIN;
CREATE TABLE `facialactivity_activity_config` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `level` varchar(10) NOT NULL,
    `tag` varchar(10) NOT NULL,
    `threshold` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    UNIQUE (`level`, `tag`)
)
;
CREATE TABLE `facialactivity_user_image` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `click_nums` integer NOT NULL,
    `fake_exceed_nums` integer NOT NULL DEFAULT 0,
    `real_click_nums` integer NOT NULL DEFAULT 0,
    `image_url` varchar(200) NOT NULL UNIQUE,
    `form_id` VARCHAR (256) DEFAULT '',
    `level` integer NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL,
    `is_online` bool NOT NULL DEFAULT 1,
    `is_deleted` bool NOT NULL DEFAULT 0,
    `is_vest` bool NOT NULL DEFAULT 0,
    `is_push` bool NOT NULL DEFAULT 0,
    `is_click` bool NOT NULL DEFAULT 0,
    `is_share` bool NOT NULL DEFAULT 0
)
;
ALTER TABLE `facialactivity_user_image` ADD CONSTRAINT `user_id_refs_id_d8ea8043` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
CREATE TABLE `api_userextrawechatinfo` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL UNIQUE,
    `openid` varchar(128) NOT NULL,
    `wechat_nickname` varchar(128) NOT NULL
)DEFAULT CHARSET=utf8mb4
;
ALTER TABLE `api_userextrawechatinfo` ADD CONSTRAINT `user_id_refs_id_5c489ca4` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
CREATE INDEX `facialactivity_user_image_6340c63c` ON `facialactivity_user_image` (`user_id`);

COMMIT;
