update RDB$RELATION_FIELDS set
RDB$FIELD_SOURCE = 'ID_TYPE'
where (RDB$FIELD_NAME = 'ID_EAI_P2F_TRANSFER_LOG') and
(RDB$RELATION_NAME = 'EAI_P2F_TRANSFER_LOG');


ALTER TABLE EAI_P2F_TRANSFER_LOG ADD CONSTRAINT PK_EAI_P2F_TRANSFER_LOG PRIMARY KEY (ID_EAI_P2F_TRANSFER_LOG);

ALTER TABLE EAI_P2F_TRANSFER_LOG_LINES ADD CONSTRAINT FK_EAI_P2F_TRANSFER_LOG_LINES_1 FOREIGN KEY (ID_EAI_P2F_TRANSFER_LOG) REFERENCES EAI_P2F_TRANSFER_LOG (ID_EAI_P2F_TRANSFER_LOG) ON UPDATE CASCADE ON DELETE CASCADE;


