-- Table structure changes related to oAuth
CREATE TABLE ohrm_oauth_scope (scope TEXT, is_default BOOLEAN);
CREATE TABLE ohrm_oauth_jwt (client_id VARCHAR(80) NOT NULL, subject VARCHAR(80), public_key VARCHAR(2000), CONSTRAINT jwt_client_id_pk PRIMARY KEY (client_id));

INSERT INTO `ohrm_config` (`property`, `value`) VALUES ('training.program.enabled', '0');


/* Start Job and Salary History upgrade */

-- New table

CREATE TABLE IF NOT EXISTS `ohrm_job_record_history` (
                      `employee_number` INT(7),
                      `job_title_id` INT(13),
                      `employment_status_id` INT,
                      `employment_status_name` VARCHAR(60),
                      `job_category_id` INT,
                      `job_category_name` VARCHAR(60),
                      `joined_date` DATE,
                      `probation_end_date` DATE,
                      `date_of_permanency` DATE,
                      `effective_date` DATE,
                      `event_name` VARCHAR(100) DEFAULT NULL,
                      `subunit_id` INT(6),
                      `subunit_name` VARCHAR(100),
                      `location_id` INT,
                      `location_name` VARCHAR(110),
                      `comment` VARCHAR(250),
                      `has_contract_details` TINYINT UNSIGNED DEFAULT 0,
                      `contract_start_date` DATE,
                      `contract_end_date` DATE,
                      `contract_details` BLOB,
                      `contracted_hours` VARCHAR( 10 ) NULL DEFAULT NULL,
                      work_shift_id INT(11) DEFAULT NULL,
                      work_shift_name VARCHAR(250),
                      `version`          BIGINT(20) NOT NULL DEFAULT '0',
                      `modified_time`    datetime DEFAULT NULL,
                      `modified_by_id`   BIGINT(20) DEFAULT NULL,
                      `modified_by_name` VARCHAR(100) DEFAULT NULL,
                      `deleted` TINYINT(1) NOT NULL DEFAULT 0,
                      PRIMARY KEY (`employee_number`,`version`),
                      CONSTRAINT `ohrm_job_record_history_id` FOREIGN KEY (`employee_number`) REFERENCES
                        `ohrm_job_record` (`employee_number`) ON DELETE CASCADE ON UPDATE CASCADE
                    ) ENGINE=InnoDB DEFAULT CHARSET=UTF8;

/* End Job and Salary History upgrade */

/* create new datagroups */
INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('pim_reporting_methods', 'PIM - Configure - Reporting Methods', 1, 1, 1, 1);
SET @pim_reporting_methods_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'pim_reporting_methods');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @pim_reporting_methods_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('pim_optional_fields', 'PIM - Configure - Optional Fields', 1, 1, 1, 1);
SET @pim_optional_fields_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'pim_optional_fields');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @pim_optional_fields_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_work_shifts', 'Admin - Work Shifts', 1, 1, 1, 1);
SET @admin_work_shifts_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_work_shifts');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_work_shifts_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_nationalities', 'Admin - Nationalities', 1, 1, 1, 1);
SET @admin_nationalities_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_nationalities');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_nationalities_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_memberships', 'Admin - Memberships', 1, 1, 1, 1);
SET @admin_memberships_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_memberships');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_memberships_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_locations', 'Admin - Locations', 1, 1, 1, 1);
SET @admin_locations_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_locations');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_locations_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_localization', 'Admin - Localization', 1, 1, 1, 1);
SET @admin_localization_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_localization');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_localization_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_licenses', 'Admin - Licenses', 1, 1, 1, 1);
SET @admin_licenses_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_licenses');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_licenses_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_employment_status', 'Admin - Employment Status', 1, 1, 1, 1);
SET @admin_employment_status_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_employment_status');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_employment_status_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_education', 'Admin - Education', 1, 1, 1, 1);
SET @admin_education_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_education');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_education_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('pim_termination_reasons', 'Admin - Termination Reasons', 1, 1, 1, 1);
SET @pim_termination_reasons_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'pim_termination_reasons');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @pim_termination_reasons_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_skills', 'Admin - Skills', 1, 1, 1, 1);
SET @admin_skills_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_skills');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_skills_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_job_categories', 'Admin - Job Categories', 1, 1, 1, 1);
SET @admin_job_categories_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_job_categories');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_job_categories_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_organization_general_information', 'Admin - Organization General Information', 1, 1, 1, 1);
SET @admin_organization_general_information_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_organization_general_information');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_organization_general_information_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('pim_data_import', 'PIM - Configure - Data Import', 1, 1, 1, 1);
SET @pim_data_import_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'pim_data_import');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @pim_data_import_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_languages', 'Admin - Languages', 1, 1, 1, 1);
SET @admin_languages_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_languages');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_languages_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_salary_components', 'Admin - Salary Components', 1, 1, 1, 1);
SET @admin_salary_components_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_salary_components');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_salary_components_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_config_system_admin', 'Admin - Config System Admin', 1, 1, 1, 1);
SET @admin_config_system_admin_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_config_system_admin');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_config_system_admin_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_user_roles', 'Admin - User Roles', 1, 1, 1, 1);
SET @admin_user_roles_admin_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_user_roles');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_user_roles_admin_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_canned_reports', 'Admin - Canned Reports', 1, 1, 1, 1);
SET @admin_canned_reports_admin_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_canned_reports');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_canned_reports_admin_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_audit_trail', 'Admin - Audit Trail', 1, 1, 1, 1);
SET @admin_audit_trail_admin_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_audit_trail');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_audit_trail_admin_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_company_structure', 'Admin - Company Structure', 1, 1, 1, 1);
SET @admin_company_structure_admin_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_company_structure');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_company_structure_admin_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_preferences', 'Admin - Preferences', 1, 1, 1, 1);
SET @admin_preferences_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_preferences');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (2, @admin_preferences_data_group_id, 1, 1, 1, 1, 0);

INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
      ('admin_app_change_log', 'Admin - Application Change Log', 1, 0, 0, 0);
SET @admin_app_change_log_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'admin_app_change_log');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
      (1, @admin_app_change_log_data_group_id, 1, 0, 0, 0, 0);


CREATE TABLE `ohrm_my_shortcut` (
          `id` INT AUTO_INCREMENT,
          `shortcut_creator` INT,
          `name` VARCHAR(100),
          `state` VARCHAR(255),
          `params` TEXT,
          `status` TINYINT(1) DEFAULT '1' NOT NULL,
          PRIMARY KEY(`id`)) ENGINE = INNODB;


-- Add Buzz As A menu Item
SET @buzz_module_id := (SELECT `id` FROM `ohrm_module` WHERE `name`='buzz');
INSERT INTO `ohrm_screen`(`name`, `module_id`, `action_url`) VALUES ('Buzz',@buzz_module_id,'viewBuzz');
SET @parent_screen_id := (SELECT `id` FROM `ohrm_menu_item` WHERE `menu_title`='More');
SET @screen_id := (SELECT `id` FROM `ohrm_screen` WHERE `name`='Buzz');
INSERT INTO `ohrm_menu_item`(`menu_title`, `screen_id`, `parent_id`, `level`, `order_hint`, `status`, `url_extras`) VALUES ('Buzz', @screen_id, @parent_screen_id, 2, 951, 1, 'open_in_new_window');
INSERT INTO `ohrm_user_role_screen`(`user_role_id`, `screen_id`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES (1,@screen_id,1,1,1,1);
INSERT INTO `ohrm_user_role_screen`(`user_role_id`, `screen_id`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES (2,@screen_id,1,1,1,1);
INSERT INTO `ohrm_user_role_screen`(`user_role_id`, `screen_id`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES (3,@screen_id,1,1,1,1);


/* 6.1 related database changes */


SET @hod_user_role_id := (SELECT `id` FROM `ohrm_user_role` WHERE `name` = 'HeadOfDepartment' AND `is_predefined` = 1);
SET @leave_calendar_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'leave_calendar');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES (@hod_user_role_id, @leave_calendar_data_group_id, 1, 0, 0, 0, 0);
/* End 6.1 related database changes */


/*5.3 fixes merging to 6.x - Be aware this fix may be added to the 5.3 at the time of upgrade*/
SET @config_admin_role_id := (SELECT `id` FROM `ohrm_user_role` WHERE `name` = 'ConfigAdmin');
INSERT INTO `ohrm_home_page` (`user_role_id`, `action`, `enable_class`, `priority`) VALUES 
                    (@config_admin_role_id, '/client/admin/mail_configuration', 'EmailSettingsHomePageEnabler', 200);
/*End 5.3 fixes merging to 6.x - Be aware */

/* 6.1.2 related database changes */

SET @admin_module_screen_id := (SELECT `id` FROM `ohrm_screen` WHERE `action_url` = 'viewAdminModule');
SET @employee_competencies_data_group_id := (SELECT `id` FROM `ohrm_data_group` WHERE `ohrm_data_group`.`name` = 'employee_competencies');
INSERT INTO `ohrm_data_group_screen` (`data_group_id`, `screen_id`, `permission`, `self`) VALUES (@employee_competencies_data_group_id, @admin_module_screen_id, '1', '0');
        

/* End 6.1.2 related database changes */


SET @taxExemptionsDataGroupId := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'tax_exemptions');
SET @leftMenuItemId := (SELECT `id` FROM `ohrm_menu_item` WHERE `menu_title`='Tax Exemptions');
INSERT INTO `ohrm_menu_item_data_group` (`menu_item_id`, `data_group_id`) VALUES (@leftMenuItemId, @taxExemptionsDataGroupId);

SET @salary_history_DataGroupId := (SELECT `id` FROM `ohrm_data_group` WHERE `name`= 'salary_history');
SET @leftMenuItemId :=(SELECT `id` FROM `ohrm_menu_item` WHERE `menu_title`='Salary');
INSERT INTO `ohrm_menu_item_data_group` (`menu_item_id`, `data_group_id`) VALUES (@leftMenuItemId, @salary_history_DataGroupId);


INSERT INTO `ohrm_config` (`property`, `value`) VALUES ('news.arrange_order.enabled', '0');
INSERT INTO `ohrm_token`(`name`, `display_name`, `class_name`, `entity_name`, `value_getters`, `data_group_id`, `is_date`, `localize`,`parameters`) VALUES   ('directory.employeeOpCountry','Employee Operational Location',null,'Employee','getCountryName',null,0,0,null);

INSERT INTO `ohrm_oauth_client` (`client_id`, `client_secret`) VALUES ("public_rest_api_client", "")  ON DUPLICATE KEY UPDATE client_secret=client_secret;


/* Start Job and Salary History upgrade */

-- Data groups - Job
INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES ('job_history', 'PIM - Job - History', 1, NULL, NULL, 1);
SET @job_history_data_group := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'job_history');
SET @job_data_group := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'job_history_details');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`)
    SELECT u.user_role_id, @job_history_data_group, u.can_read, 0, 0, u.can_update, u.self FROM ohrm_user_role_data_group u WHERE u.data_group_id = @job_data_group;

INSERT INTO `ohrm_user_role_type_data_group` (`user_role_type_id`, `data_group_id`)
    SELECT u.user_role_type_id, @job_history_data_group FROM `ohrm_user_role_type_data_group` u WHERE u.data_group_id = @job_data_group;


-- Data groups - Salary
INSERT INTO `ohrm_data_group` (`name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES ('salary_history', 'PIM - Salary - History', 1, NULL, NULL, 1);
SET @salary_history_data_group := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'salary_history');
SET @salary_data_group := (SELECT `id` FROM `ohrm_data_group` WHERE `name` = 'salary_history_details');
INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`)
    SELECT u.user_role_id, @salary_history_data_group, u.can_read, 0, 0, u.can_update, u.self FROM `ohrm_user_role_data_group` u WHERE u.data_group_id = @salary_data_group;

INSERT INTO `ohrm_user_role_type_data_group` (`user_role_type_id`, `data_group_id`)
    SELECT u.user_role_type_id, @salary_history_data_group FROM `ohrm_user_role_type_data_group` u WHERE u.data_group_id = @salary_data_group;

/* End Job and Salary History upgrade */


-- Changes from 5.4 to 6.1.2

INSERT INTO `ohrm_workflow_state_machine`(`workflow`,`state`,`role`,`action`,`resulting_state`, `roles_to_notify`, `priority`)  VALUES
    ('5', 'INITIAL', 'Hiring Manager', 'CREATE', 'NEW', '', 0),
    ('5', 'NEW ', 'Hiring Manager', 'PUBLISH', 'PUBLISHED', 'Admin,HiringManager,Subscriber', 0),
    ('5', 'PUBLISHED', 'Hiring Manager', 'CLOSE', 'CLOSED', 'Admin,HiringManager,Subscriber', 0),
    ('5', 'PUBLISHED', 'Hiring Manager', 'UNPUBLISH', 'UNPUBLISHED', 'Admin,HiringManager,Subscriber', 0),
    ('5', 'UNPUBLISHED', 'Hiring Manager', 'PUBLISH', 'PUBLISHED','Admin,HiringManager,Subscriber', 0),
    ('5', 'CLOSED', 'Hiring Manager','REOPEN','NEW','', 0);

-- Changes from 5.4 to 6.1.2 Ends