alter table nc_operation_log drop foreign key FK_96neb6e8fwj8cllxbbvkq6opw;
alter table nc_operation_log drop index  FK_96neb6e8fwj8cllxbbvkq6opw;
alter table eap_user add status int default 1 null comment '1启用2禁用';
INSERT INTO nexus_eap.eap_policy_rule (created, updated, description, is_enabled, name, params, target_type, rule_set_id)
select distinct '2023-05-17 14:28:45', '2023-08-11 23:24:57', '可访问应用配置', true, 'com.senlime.user.resource', '{"is_enabled":true,"resource_list":[]}', 0, rule_set_id from eap_policy_rule;
INSERT INTO nexus_eap.nc_property (id, created, updated, property_key, property_value) VALUES (23, '2023-07-25 11:18:29', '2023-08-14 02:21:40', 'log_back_day', '[{"system_log":999},{"audit_log":999}]');


create table nc_operation_log_back
(
    id          bigint  primary key,
    created     datetime     null,
    updated     datetime     null,
    description varchar(255) null,
    success     bit          null,
    type        int          null,
    operator_id bigint       null,
    user_agent  varchar(255) null,
    account     varchar(50)  null comment '登录账号',
    sync_time   datetime null
);


create table nc_resource
(
    id      bigint auto_increment
        primary key,
    name    varchar(200) null,
    ip      varchar(200) null,
    port    int          null,
    status  int          null comment '0禁用1启用',
    created datetime     null,
    updated datetime     null
);

 
create table nc_audit_log
(
    id           bigint auto_increment
        primary key,
    visit_time   datetime                           null comment '访问时间',
    user_id      bigint                             null,
    user_name    varchar(100)                       null comment '用户名',
    device_type  varchar(100)                       null,
    device_name  varchar(200)                       null,
    service_name varchar(200)                       null,
    target_ip    varchar(200)                       null,
    target_port  int                                null,
    created      datetime default CURRENT_TIMESTAMP null,
    updated      datetime default CURRENT_TIMESTAMP null,
    email        varchar(100)                       null,
    mobile       varchar(100)                       null,
    device_id    bigint                             null
);


create table nc_audit_log_back
(
    id           bigint                             not null
        primary key,
    visit_time   datetime                           null comment '访问时间',
    user_id      bigint                             null comment '账号',
    user_name    varchar(100)                       null comment '用户名',
    device_type  varchar(100)                       null,
    device_name  varchar(200)                       null,
    service_name varchar(200)                       null,
    target_ip    varchar(200)                       null,
    target_port  int                                null,
    created      datetime default CURRENT_TIMESTAMP null,
    updated      datetime default CURRENT_TIMESTAMP null,
    sync_time    datetime default CURRENT_TIMESTAMP null,
    email        varchar(100)                       null,
    mobile       varchar(100)                       null,
    device_id    bigint                             null
);