-- Deploy gaia:2019_08_30_add_protect_phone to mysql

BEGIN;

CREATE TABLE `api_protectphone` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `favor` varchar(128) NOT NULL,
    `city_id` varchar(64) NOT NULL,
    `operator` varchar(32) NOT NULL,
    `user_id` varchar(64) NOT NULL,
    `wechat` varchar(64),
    `is_get_wechat` bool NOT NULL,
    `bind_time` datetime(6),
    `unbind_time` datetime(6),
    `create_time` datetime(6),
    `update_time` datetime(6),
    `subscriptionid` varchar(128),
    `call_status` integer NOT NULL,
    `event_id` varchar(64),
    `event_type` integer,
    `is_online` bool NOT NULL
)
;

CREATE TABLE `api_protectphonelog` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `a_user_id` varchar(128) NOT NULL,
    `b_user_id` varchar(128) NOT NULL,
    `x_phone_num` varchar(128) NOT NULL,
    `subscriptionid` varchar(128),
    `is_delete` bool NOT NULL,
    `create_time` datetime(6),
    `update_time` datetime(6),
    `event_type` integer,
    `protect_phone_id` integer NOT NULL
)
;

COMMIT;
