CREATE TABLE ohrm_external_integration_process (
  id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255) NOT NULL,
  configuration TEXT,
  parameters TEXT,
  isConsumer tinyint DEFAULT '0' NOT NULL,
  enabled tinyint DEFAULT '0' NOT NULL
) ENGINE = INNODB;

CREATE TABLE ohrm_external_integration_schema_rule (
  id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255) NOT NULL,
  configuration TEXT,
  enabled tinyint DEFAULT '0' NOT NULL
) ENGINE = INNODB;

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
('integration_data_export', 'Integration - Data Export', 1, 0, 0, 0);

SET @integration_data_export := (SELECT id FROM ohrm_data_group WHERE name = 'integration_data_export');

INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`)  (SELECT id, @integration_data_export , 1 ,0 , 0, 0, 0 FROM ohrm_user_role WHERE name = 'Admin');

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
('integration_data_import', 'Integration - Data Import', 0, 1, 0, 0);

SET @integration_data_import := (SELECT id FROM ohrm_data_group WHERE name = 'integration_data_import');

INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`)  (SELECT id, @integration_data_import , 0 ,1 , 0, 0, 0 FROM ohrm_user_role WHERE name = 'Admin');


