alter table `CANDIDACY_PERIOD` add `CANDIDACY_FINALIZATION_PERIOD_END_DATE` timestamp NULL default NULL, add `CANDIDACY_FINALIZATION_PERIOD_START_DATE` timestamp NULL default NULL;

alter table `CANDIDATE_REGISTRATION_EMAIL_TEMPLATES` add `EMAIL_BODY_TUITION_PAYED` text, add `EMAIL_SUBJECT_TUITION_PAYED` text;

update CANDIDACY_DOCUMENT CD, GENERIC_FILE GF, CANDIDACY C set GF.PERMITTED_GROUP=concat(substring(GF.PERMITTED_GROUP,1,72),"candidacyOwnerGroup(", C.ID_INTERNAL, ")") where GF.OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.candidacy.CandidacyDocumentFile' AND GF.OID_CANDIDACY_DOCUMENT=CD.OID AND CD.OID_CANDIDACY=C.OID;

alter table `CANDIDACY` add `OID_CONTRIBUTOR` bigint unsigned;
alter table `CONTRIBUTOR` add `OID_CANDIDACY` bigint unsigned;
