DROP TABLE IF EXISTS `jy_platform_user_wait`;
CREATE TABLE `jy_platform_user_wait`  (
                                          `id` int NOT NULL AUTO_INCREMENT,
                                          `name` varchar(255)  NULL DEFAULT NULL,
                                          `platform_id` int NULL DEFAULT NULL,
                                          `rec_status` varchar(255) NULL DEFAULT 'A',
                                          `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
                                          `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                                          `id_card` varchar(255) NULL DEFAULT NULL,
                                          PRIMARY KEY (`id`) USING BTREE,
                                          UNIQUE INDEX `id_card_index`(`id_card`, `rec_status`) USING BTREE
);



ALTER TABLE `4dkankan_v4`.`jy_user`
    ADD COLUMN `phone` varchar(255)  DEFAULT NULL COMMENT '手机号码' AFTER `status`;
    ADD COLUMN `id_card` varchar(255)  DEFAULT NULL COMMENT '身份证号码' AFTER `phone`;
    ADD COLUMN `is_jm` int NULL DEFAULT 1 COMMENT '0否，1是'  AFTER `id_card`;
    ADD COLUMN `platform_id` int NULL AFTER `is_jm`;


DELETE FROM jy_user WHERE rec_status != 'A';

update jy_user set platform_id = 1 ;


ALTER TABLE `4dkankan_v4`.`jy_user`
    ADD UNIQUE INDEX `ry_id_index`(`ry_id`, `rec_status`) USING HASH;

ALTER TABLE `4dkankan_v4`.`jy_user`
    ADD UNIQUE INDEX `ry_no_index`(`ry_no`, `rec_status`) USING HASH;

ALTER TABLE `4dkankan_v4`.`jy_user`
    ADD UNIQUE INDEX `phone_index`(`phone`, `rec_status`) USING HASH;

ALTER TABLE `4dkankan_v4`.`jy_user`
    ADD UNIQUE INDEX `id_card_index`(`id_card`, `rec_status`) USING HASH;


DELETE FROM sys_user WHERE rec_status != 'A';

ALTER TABLE `4dkankan_v4`.`sys_user`
    ADD UNIQUE INDEX `user_name_index`(`user_name`, `rec_status`) USING HASH;

DELETE FROM t_user WHERE rec_status != 'A';

ALTER TABLE `4dkankan_v4`.`t_user`
    ADD UNIQUE INDEX `user_name_index`(`user_name`, `rec_status`) USING HASH;


ALTER TABLE t_camera_detail MODIFY total_space BIGINT NOT NULL;

ALTER TABLE t_camera_detail MODIFY used_space BIGINT NOT NULL;