-- 2020-08-19 动态评论表
ALTER TABLE `friendship`.`dynamic_comment`
ADD COLUMN `status` tinyint(2) NULL COMMENT '审核状态' AFTER `create_time`;

ALTER TABLE `friendship`.`dynamic_comment_like_detail`
ADD UNIQUE INDEX `idx_userId_commetnId`(`dynamic_comment_id`, `user_id`) USING BTREE COMMENT '用户id和评论id唯一索引';

ALTER TABLE `friendship`.`dynamic_comment`
MODIFY COLUMN `status` tinyint(2) NULL DEFAULT 0 COMMENT '审核状态' AFTER `create_time`;
MODIFY COLUMN `status` tinyint(2) NULL DEFAULT 0 COMMENT '审核状态' AFTER `create_time`;/**/


-- 修改广告商id
ALTER TABLE `friendship`.`user_device`
MODIFY COLUMN `advertiser_id` varchar(64) NULL DEFAULT NULL COMMENT '广告商主键' AFTER `advertiser`;

ALTER TABLE `friendship`.`daily_dynamics`
ADD COLUMN `recommend_time` timestamp(0) NULL COMMENT '推荐时间' AFTER `style`;

-- 2020/08/25 10:56
ALTER TABLE `friendship`.`user_device`
ADD COLUMN `is_ad_activation` tinyint(2) NULL DEFAULT 1 COMMENT '广告渠道激活状态0:激活,1:未激活' AFTER `create_time`;

ALTER TABLE `friendship`.`byte_dance_monitoring`
MODIFY COLUMN `ua` varchar(200) null COMMENT 'ua' AFTER `ip`,
MODIFY COLUMN `callback_url` varchar(300) null COMMENT '直接把调用事件回传接口的url生成出来，广告主可以直接使用' AFTER `ts`,
MODIFY COLUMN `os` tinyint(2) null COMMENT '操作系统平台安卓：0,IOS：1,其他：3' AFTER `oaid`;

ALTER TABLE `friendship`.`byte_dance_monitoring`
DROP COLUMN `callback_url`,
ADD COLUMN `callback_param` varchar(300) null COMMENT '一些跟广告信息相关的回调参数，内容是一个加密字符串，在调用事件回传接口的时候会用到' AFTER `ts`;

-- 2020/08/31 11:03
ALTER TABLE `friendship`.`byte_dance_monitoring`
DROP COLUMN `aid_name`,
DROP COLUMN `cid_name`,
DROP COLUMN `campaign_id`,
DROP COLUMN `campaign_name`,
DROP COLUMN `ip`,
DROP COLUMN `ua`,
DROP COLUMN `model`;

ALTER TABLE `friendship`.`user_device`
ADD COLUMN `idfa_md5` varchar(64) NULL COMMENT '原idfa计算MD5，再转大写' AFTER `idfa`;


-- 公会用户
ALTER TABLE `friendship`.`club_user`
ADD COLUMN `cancel_time` timestamp(0) NULL COMMENT '取消加入公会申请时间' AFTER `out_club_time`;

-- 公会账户
ALTER TABLE `friendship`.`club_account`
ADD COLUMN `rate` double(2, 2) NULL COMMENT '分成比例' AFTER `update_time`;

-- 平台详情表
ALTER TABLE `friendship`.`platform_detail`
ADD COLUMN `club_id` bigint(20) NULL COMMENT '公会id' AFTER `create_time`,
ADD COLUMN `club_sugar` double(10, 2) NULL COMMENT '公会分成' AFTER `club_id`;

-- 公会账户
ALTER TABLE `friendship`.`club_account`
MODIFY COLUMN `income_total` double(10, 4) NULL DEFAULT NULL COMMENT '总收益(单位元)' AFTER `club_id`,
MODIFY COLUMN `with_draw_total` double(10, 4) NULL DEFAULT NULL COMMENT '总体现(单位元)' AFTER `income_total`,
MODIFY COLUMN `balance` double(10, 4) NULL DEFAULT NULL COMMENT '余额(单位元)' AFTER `with_draw_total`;
ALTER TABLE `friendship`.`club_account`
ADD COLUMN `service_total_amount` double(10, 4) NULL COMMENT '服务总收益' AFTER `rate`,
ADD COLUMN `consume_total_amount` double(10, 4) NULL COMMENT '消费总收益' AFTER `service_total_amount`;


-- 公会账户详情
ALTER TABLE `friendship`.`club_account_detail`
MODIFY COLUMN `before_balance` double(20, 4) NULL DEFAULT 0.00 COMMENT '交易前余额' AFTER `trade_beans`,
MODIFY COLUMN `trade_money` double(10, 4) NULL DEFAULT 0.00 COMMENT '交易金额' AFTER `before_balance`,
MODIFY COLUMN `after_balance` double(20, 4) NULL DEFAULT 0.00 COMMENT '交易后的余额' AFTER `trade_money`;

-- 公会
ALTER TABLE `friendship`.`club`
ADD COLUMN `new_logo` varchar(255) NULL COMMENT '修改的公会logo' AFTER `code`,
ADD COLUMN `new_club_des` varchar(140) NULL COMMENT '修改的公会描述' AFTER `new_logo`,
ADD COLUMN `new_wechat_name` varchar(32) NULL COMMENT '修改的公会微信号' AFTER `new_club_des`,
ADD COLUMN `new_club_name` varchar(32) NULL COMMENT '修改的公会名称' AFTER `new_wechat_name`,
ADD COLUMN `edit_verify_status` tinyint(2) NULL COMMENT '公会修改审核状态' AFTER `new_club_name`;
ALTER TABLE `friendship`.`club`
ADD COLUMN `remark` varchar(64) NULL COMMENT '拒绝理由' AFTER `edit_verify_status`;

ALTER TABLE `friendship`.`club`
MODIFY COLUMN `edit_verify_status` tinyint(2) NULL DEFAULT 0 COMMENT '公会修改审核状态' AFTER `new_club_name`;
ALTER TABLE `friendship`.`club`
ADD UNIQUE INDEX `idx_userId`(`user_id`) USING BTREE COMMENT '用户id唯一';

-- 平台
ALTER TABLE `friendship`.`platform_detail`
MODIFY COLUMN `user_id` bigint(20) NULL DEFAULT NULL COMMENT '收到打赏的用户id,可能为空' AFTER `id`,
ADD COLUMN `from_user_id` bigint(20) NULL COMMENT '消费的用户id' AFTER `club_sugar`;
--2020/08/26 17:31
ALTER TABLE `friendship`.`dynamic_comment`
ADD COLUMN `read_status` tinyint(2) NULL DEFAULT 0 COMMENT '已读状态' AFTER `status`;

-- 2020/08/27 9:57
ALTER TABLE `friendship`.`dynamic_comment_like_detail`
ADD COLUMN `read_status` tinyint(2) NULL DEFAULT 0 COMMENT '已读状态' AFTER `create_time`;

-- 公会账户
ALTER TABLE `friendship`.`club_account`
MODIFY COLUMN `income_total` double(10, 4) NULL DEFAULT 0 COMMENT '总收益(单位元)' AFTER `club_id`,
MODIFY COLUMN `with_draw_total` double(10, 4) NULL DEFAULT 0 COMMENT '总体现(单位元)' AFTER `income_total`,
MODIFY COLUMN `balance` double(10, 4) NULL DEFAULT 0 COMMENT '余额(单位元)' AFTER `with_draw_total`,
MODIFY COLUMN `service_total_amount` double(10, 4) NULL DEFAULT 0 COMMENT '服务总收益' AFTER `rate`,
MODIFY COLUMN `consume_total_amount` double(10, 4) NULL DEFAULT 0 COMMENT '消费总收益' AFTER `service_total_amount`;

-- 2020/08/30 14:30
ALTER TABLE `friendship`.`user_account_with_draw_detail`
ADD COLUMN `open_id` bigint(20) NULL COMMENT 'openId' AFTER `user_card_id`;

-- 2020/09/01 11:35
ALTER TABLE `friendship`.`user`
ADD COLUMN `transformation_state` tinyint(2) null COMMENT '来源于渠道的转化状态' AFTER `game_authenticate`;
ALTER TABLE `friendship`.`user`
ADD COLUMN `logout_time` timestamp(0) NULL COMMENT '注销时间' AFTER `transformation_state`;

ALTER TABLE `friendship`.`user`
ADD UNIQUE INDEX `idx_wxid`(`wx_id`(32)) USING BTREE;

ALTER TABLE `friendship`.`user_device`
ADD COLUMN `active_channel` tinyint(2) null COMMENT '激活转化的广告渠道' AFTER `is_ad_activation`;

-- 2020/09/02 16:25
ALTER TABLE `friendship`.`user_account_with_draw_detail`
ADD COLUMN `club_id` bigint(20) NULL COMMENT '提现的工会id' AFTER `user_card_id`;

-- 2020/09/03 11:52
ALTER TABLE `friendship`.`user_account_with_draw_detail`
ADD COLUMN `wx_partner_trade_no` varchar(32) NULL COMMENT '微信商户订单号' AFTER `open_id`,
ADD COLUMN `wx_payment_no` varchar(64) NULL COMMENT '微信微信付款单号' AFTER `wx_partner_trade_no`;

-- 2020/09/03 19:59
ALTER TABLE `friendship`.`user_wechat_info`
MODIFY COLUMN `open_id` varchar(32) NULL COMMENT '微信openId' AFTER `user_id`;
ALTER TABLE `friendship`.`user_wechat_info`
ADD UNIQUE INDEX `idx-userId`(`user_id`) USING BTREE COMMENT '用户id唯一';



ALTER TABLE `friendship`.`user_account_with_draw_detail`
MODIFY COLUMN `open_id` varchar(32) NULL COMMENT '微信openId' AFTER `user_card_id`;

-- 公会账户
ALTER TABLE `friendship`.`club_account`
MODIFY COLUMN `income_total` double(10, 3) NULL DEFAULT 0.0000 COMMENT '总收益(单位元)' AFTER `club_id`,
MODIFY COLUMN `with_draw_total` double(10, 3) NULL DEFAULT 0.0000 COMMENT '总体现(单位元)' AFTER `income_total`,
MODIFY COLUMN `balance` double(10, 3) NULL DEFAULT 0.0000 COMMENT '余额(单位元)' AFTER `with_draw_total`,
MODIFY COLUMN `service_total_amount` double(10, 3) NULL DEFAULT 0.0000 COMMENT '服务总收益' AFTER `rate`,
MODIFY COLUMN `consume_total_amount` double(10, 3) NULL DEFAULT 0.0000 COMMENT '消费总收益' AFTER `service_total_amount`;