alter table `ROOT_DOMAIN_OBJECT` add column `KEY_EXTERNAL_INSTITUTION_UNIT` int(11) default NULL;
alter table `ROOT_DOMAIN_OBJECT` add column `KEY_INSTITUTION_UNIT` int(11) default NULL;
alter table `ROOT_DOMAIN_OBJECT` add key `KEY_EXTERNAL_INSTITUTION_UNIT` (`KEY_EXTERNAL_INSTITUTION_UNIT`);
alter table `ROOT_DOMAIN_OBJECT` add key `KEY_INSTITUTION_UNIT` (`KEY_INSTITUTION_UNIT`);

alter table `PARTY` add column `KEY_ROOT_DOMAIN_OBJECT_FOR_INSTITUTION_UNIT` int(11) default 1;
alter table `PARTY` add column `KEY_ROOT_DOMAIN_OBJECT_FOR_EXTERNAL_INSTITUTION_UNIT` int(11) default 1;
alter table `PARTY` add key `KEY_ROOT_DOMAIN_OBJECT_FOR_INSTITUTION_UNIT` (`KEY_ROOT_DOMAIN_OBJECT_FOR_INSTITUTION_UNIT`);
alter table `PARTY` add key `KEY_ROOT_DOMAIN_OBJECT_FOR_EXTERNAL_INSTITUTION_UNIT` (`KEY_ROOT_DOMAIN_OBJECT_FOR_EXTERNAL_INSTITUTION_UNIT`);

alter table `ACCOUNTABILITY` add column `CONTRACT_TYPE` varchar(50) not NULL default '';

insert into `ACCOUNTABILITY_TYPE` (`TYPE`, `OJB_CONCRETE_CLASS`, `NAME`) values ('EMPLOYEE_CONTRACT', 'net.sourceforge.fenixedu.domain.organizationalStructure.AccountabilityType', 'EMPLOYEE_CONTRACT');

update `ROOT_DOMAIN_OBJECT` set `KEY_EXTERNAL_INSTITUTION_UNIT` = 61558;
update `ROOT_DOMAIN_OBJECT` set `KEY_INSTITUTION_UNIT` = 61559;

delete from EXTERNAL_PERSON where ID_INTERNAL = 6409;