create table UNIT_ACRONYM (
  `ACRONYM` text,
  `ID_INTERNAL` int(11) NOT NULL auto_increment,
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL DEFAULT '1',
  primary key (ID_INTERNAL),
  index (KEY_ROOT_DOMAIN_OBJECT)
) type=InnoDB ;

-- ISCTE
ALTER TABLE PARTY CHANGE COLUMN ACRONYM ACRONYM VARCHAR(15);

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

INSERT INTO UNIT_ACRONYM (ACRONYM)
SELECT DISTINCT(LOWER(PARTY.ACRONYM)) FROM PARTY WHERE PARTY.ACRONYM IS NOT NULL;

UPDATE PARTY, UNIT_ACRONYM SET PARTY.KEY_UNIT_ACRONYM = UNIT_ACRONYM.ID_INTERNAL WHERE PARTY.ACRONYM IS NOT NULL AND LOWER(PARTY.ACRONYM) = LOWER(UNIT_ACRONYM.ACRONYM);  

