-- Deploy gaia:2019_10_09_sign_table to mysql

BEGIN;

CREATE TABLE `api_sign_blind_prize` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(128) NOT NULL,
    `img_url` varchar(256) NOT NULL,
    `probability` integer NOT NULL,
    `is_online` bool NOT NULL,
    `is_final` bool NOT NULL,
    `show_order` integer NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
CREATE TABLE `api_sign_user_blind_card` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `blind_prize_id` integer NOT NULL,
    `count` integer NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
CREATE TABLE `api_sign_blind_relate_prize` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(256) NOT NULL,
    `img_url` varchar(256) NOT NULL,
    `count` integer NOT NULL,
    `description` varchar(256) NOT NULL,
    `is_online` bool NOT NULL,
    `blind_box_ids` varchar(256) NOT NULL,
    `show_order` integer NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
CREATE TABLE `api_sign_exchange_prize` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `prize_id` integer NOT NULL,
    `check_adress` bool NOT NULL,
    `express_no` varchar(64),
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
CREATE TABLE `api_sign_user_task` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `task_type` integer NOT NULL,
    `task_value` varchar(128) NOT NULL,
    `finish_time` date NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
CREATE TABLE `api_sign_assist_user` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `assist_user_id` integer NOT NULL,
    `user_id` integer NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;

ALTER TABLE `api_userinfo_sign_v2` ADD COLUMN `points_count` integer NOT NULL;
ALTER TABLE `api_userinfo_sign_v2` ADD COLUMN `show_point` integer NOT NULL;

COMMIT;
