SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for core_log_login
-- ----------------------------
CREATE TABLE `core_log_login`
(
    `id`          varchar(50) NOT NULL,
    `create_time` datetime    NOT NULL,
    `update_time` datetime    NOT NULL,
    `is_deleted`  int(6)      NOT NULL DEFAULT '0',
    `user_id`     varchar(50)          DEFAULT NULL COMMENT '用户id',
    `user_name`   varchar(255)         DEFAULT NULL COMMENT '用户姓名',
    `platform`    varchar(50)          DEFAULT NULL COMMENT '登录方式',
    `ip`          varchar(100)         DEFAULT NULL COMMENT 'ip',
    `address`     varchar(255)         DEFAULT NULL COMMENT 'ip地址',
    PRIMARY KEY (`id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4 COMMENT ='日志-登录';

-- ----------------------------
-- Table structure for core_log_message
-- ----------------------------
CREATE TABLE `core_log_message`
(
    `id`          varchar(50) NOT NULL,
    `create_time` datetime    NOT NULL,
    `update_time` datetime    NOT NULL,
    `is_deleted`  int(6)      NOT NULL DEFAULT '0',
    `type`        varchar(50)          DEFAULT NULL COMMENT '类型',
    `target`      varchar(255)         DEFAULT NULL COMMENT '发送对象',
    `content`     text COMMENT '发送内容',
    `resp_body`   text COMMENT '返回结果',
    `result`      int(6)      NOT NULL DEFAULT '0' COMMENT '结果',
    PRIMARY KEY (`id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4
  ROW_FORMAT = DYNAMIC COMMENT ='日志-消息';

-- ----------------------------
-- Table structure for core_log_process
-- ----------------------------
CREATE TABLE `core_log_process`
(
    `id`          varchar(50)  NOT NULL,
    `create_time` datetime     NOT NULL,
    `update_time` datetime     NOT NULL,
    `is_deleted`  int(6)       NOT NULL DEFAULT 0,
    `title`       varchar(255) NULL     DEFAULT NULL COMMENT '标题',
    `total`       int(11)      NOT NULL DEFAULT 0 COMMENT '总数',
    `success_num` int(11)      NOT NULL DEFAULT 0 COMMENT '成功数',
    `fail_num`    int(11)      NOT NULL DEFAULT 0 COMMENT '失败数',
    `type`        varchar(50)  NOT NULL DEFAULT 'import' COMMENT '类型（import-导入，sync-同步）',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '日志-过程'
  ROW_FORMAT = Dynamic;

ALTER TABLE core_log_process
    ADD status int(6) default 0 COMMENT '状态（0-未完成，1-已完成）';

ALTER TABLE core_log_process
    ADD fail_file varchar(500) null default null COMMENT '失败的文件';

ALTER TABLE core_log_process
    ADD error text null default null COMMENT '异常说明';

ALTER TABLE core_log_process
    ADD process int(6) not null default 0 COMMENT '进度';

-- ----------------------------
-- Table structure for core_log_operation
-- ----------------------------

CREATE TABLE `core_log_operation`
(
    `id`          varchar(50) NOT NULL,
    `create_time` datetime    NOT NULL,
    `update_time` datetime    NOT NULL,
    `is_deleted`  int(6)      NOT NULL DEFAULT '0',
    `user_id`     varchar(50)          DEFAULT NULL COMMENT '用户id',
    `user_name`   varchar(255)         DEFAULT NULL COMMENT '用户名称',
    `title`       varchar(255)         DEFAULT NULL COMMENT '标题',
    `subject`     varchar(500)         DEFAULT NULL COMMENT '小标题',
    `params`      longtext COMMENT '其他参数',
    PRIMARY KEY (`id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4 COMMENT ='日志-操作';


SET FOREIGN_KEY_CHECKS = 1;
