


-- Inserted at 2008-05-27T08:37:07.668+01:00

alter table ASSIDUOUSNESS_EXEMPTION_SHIFT add index (KEY_ASSIDUOUSNESS_EXEMPTION);
alter table PARTY add column KEY_RESEARCHER int(11);
alter table PARTY add index (KEY_RESEARCHER);


create table RESEARCHER (
  `ID_INTERNAL` int(11) NOT NULL auto_increment,
  `ALLOWS_CONTACT_BY_MEDIA` tinyint(1),
  `ALLOWS_CONTACT_BY_OTHER_RESEARCHERS` tinyint(1),
  `ALLOWS_CONTACT_BY_STUDENTS` tinyint(1),
  `ALLOWS_TO_BE_SEARCHED` tinyint(1),
  `KEYWORDS` text,
  `KEY_PERSON` int(11),
  `KEY_ROOT_DOMAIN_OBJECT` int(11),
primary key (ID_INTERNAL),
  index (KEY_PERSON),
  index (KEY_ROOT_DOMAIN_OBJECT)
) type=InnoDB ;

-- now let's create the RESEARCHER OBJECTS

insert into RESEARCHER(
KEY_PERSON,
KEY_ROOT_DOMAIN_OBJECT,
ALLOWS_CONTACT_BY_MEDIA,
ALLOWS_CONTACT_BY_OTHER_RESEARCHERS,
ALLOWS_CONTACT_BY_STUDENTS,
ALLOWS_TO_BE_SEARCHED,
KEYWORDS
)
select KEY_PERSON,'1','0','0','0','0','' FROM PERSON_ROLE WHERE KEY_ROLE = (select ID_INTERNAL FROM ROLE WHERE ROLE_TYPE='RESEARCHER');

update PARTY P, RESEARCHER R set P.KEY_RESEARCHER=R.ID_INTERNAL WHERE R.KEY_PERSON=P.ID_INTERNAL;
