__IF_EXISTS__
SELECT 1
  FROM CI_UT_INSTL_DTL
WHERE SCRIPT_FILE_NAME = 'FW45010_APDATA_UGBUPD-10242_OUAF-36315.SQL'
   AND END_DTTM IS NOT NULL
/
__THEN__
__EXIT__
__ENDIF__

-- Update the Master Config BO to be 'CM' if Master Config entry is found.  (Otherwise BP will remove it.)
__IF_EXISTS__
select * from f1_mst_config where bus_obj_cd = 'F1-MobileConfigurations'
/
__THEN__
update F1_BUS_OBJ set OWNER_FLG = 'CM' where BUS_OBJ_CD = 'F1-MobileConfigurations' and OWNER_FLG <> 'CM'
/
update F1_BUS_OBJ_L set DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This Business Object is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG where BUS_OBJ_CD = 'F1-MobileConfigurations' and LANGUAGE_CD = 'ENG' and owner_flg <> 'CM'
/
update F1_BUS_OBJ_L set OWNER_FLG = 'CM' where BUS_OBJ_CD = 'F1-MobileConfigurations' and OWNER_FLG <> 'CM'
/
update F1_BUS_OBJ_OPT set OWNER_FLG = 'CM' where BUS_OBJ_CD = 'F1-MobileConfigurations' and OWNER_FLG <> 'CM'
/
update F1_SCHEMA set OWNER_FLG = 'CM' where SCHEMA_NAME = 'F1-MobileConfigurations' and SCHEMA_TYPE_FLG = 'F1BO' and OWNER_FLG <> 'CM'
/

__ELSE__
__ENDIF__

-- Update the Master Config BO and its scripts to be 'CM' if Master Config entry is found.  (Otherwise BP will remove it.)

__IF_EXISTS__
select * from f1_mst_config where bus_obj_cd = 'F1-MobileIdentityConfiguration'
/
__THEN__
update F1_BUS_OBJ set OWNER_FLG = 'CM' where BUS_OBJ_CD = 'F1-MobileIdentityConfiguration' and OWNER_FLG <> 'CM'
/
update F1_BUS_OBJ_L set DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This Business Object is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG where BUS_OBJ_CD = 'F1-MobileIdentityConfiguration' and LANGUAGE_CD = 'ENG' and owner_flg <> 'CM'
/
update F1_BUS_OBJ_L set OWNER_FLG = 'CM' where BUS_OBJ_CD = 'F1-MobileIdentityConfiguration' and OWNER_FLG <> 'CM'
/
update F1_BUS_OBJ_OPT set OWNER_FLG = 'CM' where BUS_OBJ_CD = 'F1-MobileIdentityConfiguration' and OWNER_FLG <> 'CM'
/
update F1_SCHEMA set OWNER_FLG = 'CM' where SCHEMA_NAME = 'F1-MobileIdentityConfiguration' and SCHEMA_TYPE_FLG = 'F1BO' and OWNER_FLG <> 'CM'
/
update CI_SCR set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdPre' AND OWNER_FLG <> 'CM'
/
update CI_SCR_DA set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdPre' AND OWNER_FLG <> 'CM'
/
update CI_SCR_L set DESCR254 = DESCR254 || ' (Deprecated)', DESCR4000 = 'This Script is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCR4000 where SCR_CD = 'F1-MobIdPre' AND LANGUAGE_CD = 'ENG' and owner_flg <> 'CM'
/
update CI_SCR_L set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdPre' AND OWNER_FLG <> 'CM'
/
update CI_SCR_STEP set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdPre' AND OWNER_FLG <> 'CM'
/
update CI_SCR_STEP_L set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdPre' AND OWNER_FLG <> 'CM'
/
update F1_SCHEMA set OWNER_FLG = 'CM' where SCHEMA_NAME = 'F1-MobIdPre' AND SCHEMA_TYPE_FLG = 'F1SC' AND OWNER_FLG <> 'CM'
/
update CI_SCR set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdDis' AND OWNER_FLG <> 'CM'
/
update CI_SCR_DA set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdDis' AND OWNER_FLG <> 'CM'
/
update CI_SCR_L set DESCR254 = DESCR254 || ' (Deprecated)', DESCR4000 = 'This Script is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCR4000 where SCR_CD = 'F1-MobIdDis' AND LANGUAGE_CD = 'ENG' and owner_flg <> 'CM'
/
update CI_SCR_L set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdDis' AND OWNER_FLG <> 'CM'
/
update CI_SCR_STEP set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdDis' AND OWNER_FLG <> 'CM'
/
update CI_SCR_STEP_L set OWNER_FLG = 'CM' where SCR_CD = 'F1-MobIdDis' AND OWNER_FLG <> 'CM'
/
update F1_SCHEMA set OWNER_FLG = 'CM' where SCHEMA_NAME = 'F1-MobIdDis' AND SCHEMA_TYPE_FLG = 'F1SC' AND OWNER_FLG <> 'CM'
/

__ELSE__
__ENDIF__

