DELETE
FROM `ohrm_advanced_report`
WHERE `unique_name` IN ('v_pbi_employee_v1', 'v_pbi_leave_v1', 'v_pbi_attendance_v1', 'v_pbi_performance_v1',
                        'v_pbi_job_state_change_v1', 'v_pbi_salary_state_change_v1', 'v_pbi_vacancy_v1',
                        'v_pbi_candidate_application_v1', 'v_pbi_user_account_v1', 'v_pbi_login_v1',
                        'v_pbi_public_holidays_v1', 'v_pbi_timesheet_v1', 'v_pbi_location_v1',
                        'v_pbi_leave_entitlement_v1', 'v_pbi_goals_v1', 'v_pbi_request_custom_field_v1',
                        'v_pbi_request_v1', 'v_pbi_custom_field_v1', 'v_pbi_job_event_change_v1');

DROP VIEW IF EXISTS `v_pbi_employee_v1`;
DROP VIEW IF EXISTS `v_pbi_leave_v1`;
DROP VIEW IF EXISTS `v_pbi_attendance_v1`;
DROP VIEW IF EXISTS `v_pbi_performance_v1`;
DROP VIEW IF EXISTS `v_pbi_job_state_change_v1`;
DROP VIEW IF EXISTS `v_pbi_salary_state_change_v1`;
DROP VIEW IF EXISTS `v_pbi_vacancy_v1`;
DROP VIEW IF EXISTS `v_pbi_candidate_application_v1`;
DROP VIEW IF EXISTS `v_pbi_user_account_v1`;
DROP VIEW IF EXISTS `v_pbi_login_v1`;
DROP VIEW IF EXISTS `v_pbi_public_holidays_v1`;
DROP VIEW IF EXISTS `v_pbi_timesheet_v1`;
DROP VIEW IF EXISTS `v_pbi_location_v1`;
DROP VIEW IF EXISTS `v_pbi_leave_entitlement_v1`;
DROP VIEW IF EXISTS `v_pbi_goals_v1`;
DROP VIEW IF EXISTS `v_pbi_request_custom_field_v1`;
DROP VIEW IF EXISTS `v_pbi_request_v1`;
DROP VIEW IF EXISTS `v_pbi_custom_field_v1`;
DROP VIEW IF EXISTS `v_pbi_job_event_change_v1`;

DROP FUNCTION IF EXISTS pbi_is_not_empty;
DROP FUNCTION IF EXISTS pbi_generate_entity_key;
DROP FUNCTION IF EXISTS pbi_get_employee_status;

DELETE
FROM `ohrm_data_group`
WHERE `name` = 'pbi_reports';
