CREATE TABLE `dq_job` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Incremental ID',
`job_id` BIGINT UNSIGNED NOT NULL COMMENT 'Global unique ID',
`tag` VARCHAR(60) NOT NULL COMMENT 'Split workers, route jobs with workers',
`job_name` VARCHAR(60) NOT NULL COMMENT 'Job name',
`job_type` TINYINT UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Job type',
`job_state` TINYINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Job state: 0-disabled 1-enabled',
`job_handler` TEXT NOT NULL COMMENT 'Data Quality handler DSL',
`job_param` TEXT DEFAULT NULL COMMENT 'Job parameters',
`retry_type` TINYINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Retry type: 0-don't; 1-retry failed tasks; 2-retry all tasks',
`retry_limit` TINYINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Retry max count',
`retry_interval` INT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Milliseconds',
`start_time` DATETIME(3) DEFAULT NULL COMMENT 'Start time of window when jobs can be launched',
`end_time` DATETIME(3) DEFAULT NULL COMMENT 'End time of window when jobs can be launched',
`trigger_type` TINYINT UNSIGNED NOT NULL COMMENT 'Trigger type: 1-Cron; 2-Once; 3-fixed window; 4-fixed frequency; 5-fixed delay; 6-dag',
`trigger_value` VARCHAR(255) NOT NULL COMMENT 'Trigger value according to trigger type',
`execute_timeout` INT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Tasks will be killed if timeout, milliseconds',
`collided_strategy` TINYINT UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Execution strategy if the last scheduled task was not completed: 1- Parallel execution; 2- Sequential execution; 3- Override the last task; 4- Discard the current task',
`misfire_strategy` TINYINT UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Expiration policies: 1- Trigger the most recent one; 2- Discard; 3- Trigger all',
`route_strategy` TINYINT UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Task routing strategies to which worker: 1- Round-robin; 2- Random; 3- Simple hash; 4- Consistent hash; 5- Local priority; 6- Broadcast',
`last_trigger_time` BIGINT UNSIGNED DEFAULT NULL COMMENT 'Last trigger time milliseconds',
`next_trigger_time` BIGINT UNSIGNED DEFAULT NULL COMMENT 'Next trigger time milliseconds',
`next_scan_time` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Next scan time for trigger',
`scan_failed_count` TINYINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Count for failed to launch jobs, will disable this job',
`remark` VARCHAR(255) DEFAULT NULL COMMENT 'Comments',
`version` INT UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Version',
`is_deleted` TINYINT UNSIGNED DEFAULT '0' COMMENT '0-not; NULL-yes',
`updated_by` VARCHAR(60) DEFAULT NULL COMMENT 'Operator log',
`created_by` VARCHAR(60) DEFAULT NULL COMMENT 'Operator',
`updated_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Update time',
`created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_jobid` (`job_id`),
UNIQUE KEY `uk_tag_jobname_isdeleted` (`tag`, `job_name`, `is_deleted`),
KEY `ix_jobstate_nexttriggertime` (`job_state`, `next_trigger_time`) COMMENT 'Scan table',
KEY `ix_updatedat` (`updated_at`),
KEY `ix_createdat` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT COMMENT='Job table';