alter table `JOB_EXECUTION_CONTEXT` add `RESULT` text, add `ARGUMENTS` text;

update JOB_EXECUTION_CONTEXT as JC, FF$DOMAIN_CLASS_INFO as DI set JC.OJB_CONCRETE_CLASS = DI.DOMAIN_CLASS_NAME where DI.DOMAIN_CLASS_ID = (JC.OID >> 32);
update JOB as J, FF$DOMAIN_CLASS_INFO as DI set J.OJB_CONCRETE_CLASS = DI.DOMAIN_CLASS_NAME where DI.DOMAIN_CLASS_ID = (J.OID >> 32);

update `JOB_EXECUTION_CONTEXT`
set ARGUMENTS = concat('net.sourceforge.fenixedu.domain.jobs.JobExecutionFileInput%requestor=2963527698771&fileInput=', OID_INPUT),
RESULT = concat('net.sourceforge.fenixedu.domain.jobs.JobExecutionFileOutput%fileOutput=', OID_RESULT)
where OJB_CONCRETE_CLASS = 'net.sourceforge.fenixedu.domain.JobExecutionContextWithFileInputAndOutput';

update `JOB_EXECUTION_CONTEXT`
set ARGUMENTS = 'net.sourceforge.fenixedu.domain.jobs.JobExecutionFileInput%requestor=2963527698771'
where OJB_CONCRETE_CLASS = 'com.qubit.fenixframework.plugins.job.JobExecutionContext';

update JOB_EXECUTION_CONTEXT JC, JOB_EXECUTION_LOG JL
set JC.OID = (947 << 32) + JC.ID_INTERNAL, JL.OID_CONTEXT = (947 << 32) + JC.ID_INTERNAL
where JC.OID = JL.OID_CONTEXT;

update FF$DOMAIN_CLASS_INFO
set DOMAIN_CLASS_NAME = 'net.sourceforge.fenixedu.domain.jobs.JobFileResult'
where DOMAIN_CLASS_NAME = 'net.sourceforge.fenixedu.domain.JobFileResult';

update FF$DOMAIN_CLASS_INFO
set DOMAIN_CLASS_NAME = 'net.sourceforge.fenixedu.domain.jobs.JobFileInput'
where DOMAIN_CLASS_NAME = 'net.sourceforge.fenixedu.domain.JobFileInput';
 
alter table `JOB_EXECUTION_CONTEXT` drop OJB_CONCRETE_CLASS, drop USERNAME_ORIGINS, drop OID_RESULT, drop INSTITUTIONAL_EMAIL_TO_ASSIGN, drop USERNAME_DESTINATION, drop USERNAME_TO_ASSIGN, drop OID_INPUT, drop PARAMETER;
alter table `GENERIC_FILE` drop OID_EXECUTION_CONTEXT, drop OID_IO_EXECUTION_CONTEXT;
