/*
 Navicat Premium Data Transfer
 
 Source Server         : local_mariadb
 Source Server Type    : MariaDB
 Source Server Version : 100338 (10.3.38-MariaDB)
 Source Host           : localhost:33066
 Source Schema         : omc_db
 
 Target Server Type    : MariaDB
 Target Server Version : 100338 (10.3.38-MariaDB)
 File Encoding         : 65001
 
 Date: 25/10/2023 18:24:04
 */
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sys_job
-- ----------------------------
CREATE TABLE IF NOT EXISTS `omc_db`.`sys_job` (
  `job_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务ID',
  `job_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '任务名称',
  `job_group` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'DEFAULT' COMMENT '任务组名',
  `invoke_target` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '调用目标字符串',
  `target_params` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '调用目标传入参数',
  `cron_expression` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'cron执行表达式',
  `misfire_policy` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '3' COMMENT '计划执行错误策略（1立即执行 2执行一次 3放弃执行）',
  `concurrent` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否并发执行（0禁止 1允许）',
  `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '任务状态（0暂停 1正常）',
  `save_log` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否记录任务日志（0不记录 1记录）',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` bigint(20) NULL DEFAULT 0 COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` bigint(20) NULL DEFAULT 0 COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  PRIMARY KEY (`job_id`, `job_name`, `job_group`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '调度任务调度表' ROW_FORMAT = Dynamic;

ALTER TABLE
    `omc_db`.`sys_job` DROP PRIMARY KEY,
ADD
    PRIMARY KEY (`job_id`) USING BTREE,
ADD
    UNIQUE INDEX IF NOT EXISTS `idx_uni_name_group`(`job_name`, `job_group`) USING BTREE COMMENT 'unique index for job_name and job_group';

-- ----------------------------
-- Records of sys_job
-- ----------------------------
REPLACE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        1,
        'job.monitor_sys_resource',
        'SYSTEM',
        'monitor_sys_resource',
        '{\"interval\":5}',
        '0 0/5 * * * ?',
        '3',
        '0',
        '1',
        '0',
        'supervisor',
        1698478134839,
        'supervisor',
        1700571615807,
        'job.monitor_sys_resource_remark'
    );

REPLACE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        4,
        'job.delExpiredNeBackup',
        'SYSTEM',
        'delExpiredNeBackup',
        '{\"duration\":60}',
        '0 20 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'supervisor',
        1698478134840,
        NULL,
        0,
        'job.delExpiredNeBackupRemark'
    );

REPLACE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        5,
        'job.deleteExpiredAlarmRecord',
        'SYSTEM',
        'deleteExpiredRecord',
        '{\"duration\":90,\"tableName\":\"alarm\",\"colName\":\"event_time\",\"extras\":\"alarm_status=\'0\'\"}',
        '0 10 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'supervisor',
        1698478134841,
        NULL,
        0,
        'job.deleteExpiredAlarmRecordRemark'
    );

REPLACE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        6,
        'job.deleteExpiredKpiRecord',
        'SYSTEM',
        'deleteExpiredRecord',
        '{\"duration\":15,\"tableName\":\"gold_kpi\",\"colName\":\"date\"}',
        '0 15 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'supervisor',
        1698478134842,
        'supervisor',
        1700570673113,
        'job.deleteExpiredKpiRecordRemark'
    );

REPLACE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        7,
        'job.backupEtcFromNE',
        'SYSTEM',
        'backupEtcFromNE',
        NULL,
        '0 30 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'supervisor',
        1698478134843,
        NULL,
        0,
        'job.backupEtcFromNERemark'
    );

REPLACE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        8,
        'job.deleteExpiredNeStateRecord',
        'SYSTEM',
        'deleteExpiredRecord',
        '{\"duration\":3,\"tableName\":\"ne_state\",\"colName\":\"timestamp\"}',
        '0 25 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'supervisor',
        1698478134842,
        'admin',
        1703668901929,
        'job.deleteExpiredNeStateRecordRemark'
    );

REPLACE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        9,
        'job.getStateFromNE',
        'SYSTEM',
        'getStateFromNE',
        '',
        '0/10 * * * * ?',
        '3',
        '0',
        '1',
        '0',
        'supervisor',
        1698478134842,
        'admin',
        1703669877919,
        'job.getStateFromNERemark'
    );

REPLACE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        10,
        'job.genNeStateAlarm',
        'SYSTEM',
        'genNeStateAlarm',
        '',
        '0/5 * * * * ?',
        '3',
        '0',
        '1',
        '0',
        'supervisor',
        1698478134842,
        'admin',
        1703669877919,
        'job.genNeStateAlarmRemark'
    );

SET FOREIGN_KEY_CHECKS = 1;