CREATE TABLE `ohrm_external_payroll_changed_employee`
(
    `id`                       INT(128)                              not null auto_increment,
    `changed_emp_number`       INT(7)                                NOT NULL,
    `async_event_id`           INT(4)    DEFAULT NULL,
    `external_integration_process_id`   INT(4) DEFAULT NULL,
    `changed_date`             DATETIME  DEFAULT NULL,
    `event_recorded_date_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    `fields_changed`           MEDIUMTEXT DEFAULT NULL COMMENT 'Encrypted/plain JSON containing array of object(s)',
    PRIMARY KEY (`id`),
    CONSTRAINT `fk_ohrm_changed_employee_id` FOREIGN KEY (`changed_emp_number`)
        REFERENCES `hs_hr_employee` (`emp_number`) ON DELETE CASCADE,
    CONSTRAINT `fk_ohrm_changed_employee_async_event_id` FOREIGN KEY (`async_event_id`)
        REFERENCES `ohrm_async_event` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
    CONSTRAINT `fk_ohrm_changed_employee_external_integration_process_id` FOREIGN KEY (`external_integration_process_id`)
        REFERENCES `ohrm_external_integration_process` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
    INDEX `index_changed_date` (`changed_date`),
    INDEX `index_event_recorded_date_time` (`event_recorded_date_time`)
) ENGINE = INNODB
  DEFAULT CHARSET = UTF8;

INSERT INTO ohrm_config(`property`, `value`)
VALUES ('esb.restrict_csv_download_if_validation_fails', '0');
