CREATE TABLE ohrm_advanced_task_template
(
    `id`              INT           NOT NULL AUTO_INCREMENT,
    `name`            VARCHAR(1000) NOT NULL,
    `description`     MEDIUMTEXT    NULL,
    `module_id`       INT           NOT NULL,
    `mediator`        VARCHAR(255)  NOT NULL,
    `workflow`        VARCHAR(255)  NULL,
    `form_version_id` INT UNSIGNED  NULL,
    `options`         JSON          NOT NULL DEFAULT (JSON_OBJECT()),
    PRIMARY KEY (`id`),
    CONSTRAINT `fk_ohrm_advanced_task_template_module_id` FOREIGN KEY (`module_id`) REFERENCES `ohrm_module` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
    CONSTRAINT `fk_ohrm_advanced_task_template_workflow` FOREIGN KEY (`workflow`) REFERENCES `ohrm_workflow` (`id`) ON UPDATE CASCADE ON DELETE SET NULL,
    CONSTRAINT `fk_ohrm_advanced_task_template_form_version_id` FOREIGN KEY (`form_version_id`) REFERENCES `ohrm_dynamic_form_version` (`id`) ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE = INNODB
  DEFAULT CHARSET = UTF8;