alter table `INDIVIDUAL_CANDIDACY` add column `KEY_PERSONAL_DETAILS` int(11);
alter table `INDIVIDUAL_CANDIDACY` add index (`KEY_PERSONAL_DETAILS`);

create table `INDIVIDUAL_CANDIDACY_PERSONAL_DETAILS` (
  `ID_INTERNAL` int(11) NOT NULL auto_increment,
  `INTERNALIZED` tinyint(1),
  `KEY_CANDIDACY` int(11),
  `KEY_PERSON` int(11),
  `OJB_CONCRETE_CLASS` text,
  primary key (ID_INTERNAL),
  index (KEY_CANDIDACY),
  index (KEY_PERSON)
) type=InnoDB, character set latin1 ;

insert into INDIVIDUAL_CANDIDACY_PERSONAL_DETAILS(INTERNALIZED, KEY_CANDIDACY, KEY_PERSON, OJB_CONCRETE_CLASS)
select 1, ID_INTERNAL, KEY_PERSON, "net.sourceforge.fenixedu.domain.candidacyProcess.IndividualCandidacyInternalPersonDetails"
from INDIVIDUAL_CANDIDACY;

update INDIVIDUAL_CANDIDACY set KEY_PERSONAL_DETAILS = (select INDIVIDUAL_CANDIDACY_PERSONAL_DETAILS.ID_INTERNAL from INDIVIDUAL_CANDIDACY_PERSONAL_DETAILS where INDIVIDUAL_CANDIDACY_PERSONAL_DETAILS.KEY_CANDIDACY = INDIVIDUAL_CANDIDACY.ID_INTERNAL)

#drop the KEY_PERSON column in the INDIVIDUAL_CANDIDACY table later.