-- ABS-164590 Deadlock when closing Outscan Multiread Scanner dialogue
alter table MULTIREADSCANBATCHCONTENTS drop constraint PK_MULTIREADSCANBATCHCONTENT;

alter table MULTIREADSCANBATCHCONTENTS
  add constraint PK_MULTIREADSCANBATCHCONTENT primary key (MULTIREADSCANBATCH_ID, IDCODEREAD);
  
create index XIE4MULTIREADSCANCONTENTBATCH on MULTIREADSCANBATCHCONTENTS (MULTIREADSCANBATCH_ID, IDCODE);

alter table MULTIREADSCANBATCHCONTENTS modify 
( timeframeinitial              default (floor ( (floor ( (CAST (SYSTIMESTAMP AT TIME ZONE 'UTC' AS DATE) - TO_DATE('01/01/2020', 'dd/mm/yyyy') ) * 24 * 60) - 1) / 2) * 2 + 1),
  timeframefinal                default (floor (floor ( (CAST (SYSTIMESTAMP AT TIME ZONE 'UTC' AS DATE) - TO_DATE('01/01/2020', 'dd/mm/yyyy') ) * 24 * 60) / 2) * 2));
