
-- Inserted at 2008-05-07T14:52:17.870+01:00

alter table INDIVIDUAL_CANDIDACY add column AFFINITY double;
alter table INDIVIDUAL_CANDIDACY add column CANDIDACY_DATE varchar(250);
alter table INDIVIDUAL_CANDIDACY add column CANDIDACY_GRADE double;
alter table INDIVIDUAL_CANDIDACY add column DEGREE_NATURE int(11);
alter table INDIVIDUAL_CANDIDACY add column INTERVIEW_GRADE text;
alter table INDIVIDUAL_CANDIDACY add column NOTES text;
alter table INDIVIDUAL_CANDIDACY add column PROFESSIONAL_EXPERIENCE int(11);
alter table INDIVIDUAL_CANDIDACY add column SERIES_CANDIDACY_GRADE double;
alter table INDIVIDUAL_CANDIDACY add column WHEN_CREATED datetime default NULL;

update INDIVIDUAL_CANDIDACY SET WHEN_CREATED = CURDATE(), CANDIDACY_DATE = CURDATE()  WHERE WHEN_CREATED = NULL;

-- Inserted at 2008-05-08T11:47:06.934+01:00

alter table PARTY add column KEY_PARTY_SOCIAL_SECURITY_NUMBER int(11), add index (KEY_PARTY_SOCIAL_SECURITY_NUMBER);

-- drop table if exists PARTY_SOCIAL_SECURITY_NUMBER;
create table PARTY_SOCIAL_SECURITY_NUMBER (
  `ID_INTERNAL` int(11) NOT NULL auto_increment,
  `KEY_PARTY` int(11),
  `KEY_ROOT_DOMAIN_OBJECT` int(11) default 1,
  `SOCIAL_SECURITY_NUMBER` varchar(50),
  primary key (ID_INTERNAL),
  unique (SOCIAL_SECURITY_NUMBER),
  index (KEY_PARTY),
  index (KEY_ROOT_DOMAIN_OBJECT)
) type=InnoDB ;


INSERT INTO PARTY_SOCIAL_SECURITY_NUMBER (KEY_PARTY, SOCIAL_SECURITY_NUMBER) SELECT ID_INTERNAL, SOCIAL_SECURITY_NUMBER FROM PARTY WHERE PARTY.SOCIAL_SECURITY_NUMBER IS NOT NULL AND LENGTH(PARTY.SOCIAL_SECURITY_NUMBER) > 0;
