INSERT INTO R5LISTENTITY
(LET_DATAGRID,LET_SEQNO,LET_MASK,LET_DOWNCAT,LET_GROUPID,LET_BLOCKSIZE,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_DOWNGROUP,LET_FILTERPARAMS,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_UPDATED,LET_MASTERTABLE,ROWIDENTITY)
SELECT 'BCPROMWO',169,NULL,NULL,NULL,NULL,3,'WCJOBS','R5PROPERTYVALUES','EVT_ORG',NULL,NULL,'-','-',NULL,'R5EVENTS',NULL
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM R5LISTENTITY WHERE LET_DATAGRID='BCPROMWO');

INSERT INTO R5LISTENTITY
(LET_DATAGRID,LET_SEQNO,LET_MASK,LET_DOWNCAT,LET_GROUPID,LET_BLOCKSIZE,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_DOWNGROUP,LET_FILTERPARAMS,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_UPDATED,LET_MASTERTABLE,ROWIDENTITY)
SELECT 'BCPROMOBJ',170,NULL,NULL,NULL,NULL,3,'BCPROMOBJ','R5PROPERTYVALUES','OBJ_ORG',NULL,NULL,'-','-',NULL,'',NULL
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM R5LISTENTITY WHERE LET_DATAGRID='BCPROMOBJ');

INSERT INTO R5LISTENTITY
(LET_DATAGRID,LET_SEQNO,LET_MASK,LET_DOWNCAT,LET_GROUPID,LET_BLOCKSIZE,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_DOWNGROUP,LET_FILTERPARAMS,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_UPDATED,LET_MASTERTABLE,ROWIDENTITY)
SELECT 'BCPROMP',172,NULL,NULL,NULL,NULL,3,NULL,'R5PROPERTIES',NULL,NULL,NULL,'-','-',NULL,NULL,NULL
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM R5LISTENTITY WHERE LET_DATAGRID='BCPROMP');

INSERT INTO R5LISTENTITY
(LET_DATAGRID,LET_SEQNO,LET_MASK,LET_DOWNCAT,LET_GROUPID,LET_BLOCKSIZE,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_DOWNGROUP,LET_FILTERPARAMS,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_UPDATED,LET_MASTERTABLE,ROWIDENTITY)
SELECT 'BCPROMC',173,NULL,NULL,NULL,NULL,3,'WCJOBS','R5ADDPROPERTIES',NULL,NULL,NULL,'-','-',NULL,NULL,NULL
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM R5LISTENTITY WHERE LET_DATAGRID='BCPROMC');

INSERT INTO R5LISTENTITY
(LET_DATAGRID,LET_SEQNO,LET_MASK,LET_DOWNCAT,LET_GROUPID,LET_BLOCKSIZE,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_DOWNGROUP,LET_FILTERPARAMS,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_UPDATED,LET_MASTERTABLE,ROWIDENTITY)
SELECT 'BCPROMCD',174,NULL,NULL,NULL,NULL,3,'','R5PVDESCRIPTIONS',NULL,NULL,NULL,'-','-',NULL,NULL,NULL
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM R5LISTENTITY WHERE LET_DATAGRID='BCPROMCD');

INSERT INTO R5LISTENTITY
(LET_DATAGRID,LET_SEQNO,LET_MASK,LET_DOWNCAT,LET_GROUPID,LET_BLOCKSIZE,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_DOWNGROUP,LET_FILTERPARAMS,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_UPDATED,LET_MASTERTABLE,ROWIDENTITY)
SELECT 'BCPROMV',176,NULL,NULL,NULL,NULL,3,NULL,'R5PROPERTYVALUES',NULL,NULL,NULL,'-','-',NULL,NULL,NULL
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM R5LISTENTITY WHERE LET_DATAGRID='BCPROMV');

INSERT INTO R5LISTENTITY
(LET_DATAGRID,LET_SEQNO,LET_MASK,LET_DOWNCAT,LET_GROUPID,LET_BLOCKSIZE,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_DOWNGROUP,LET_FILTERPARAMS,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_UPDATED,LET_MASTERTABLE,ROWIDENTITY)
SELECT 'BCPROMOBJWO',171,NULL,NULL,NULL,NULL,3,'BCPROMOBJWO','R5PROPERTYVALUES','EVT_ORG',NULL,NULL,'-','-',NULL,'R5EVENTS',NULL
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM R5LISTENTITY WHERE LET_DATAGRID='BCPROMOBJWO');

ALTER TABLE R5WARCOMPONENTS ADD COLUMN WCM_WORKACCOMPLISHED nvarchar(4);
ALTER TABLE R5WARCOMPONENTS ADD COLUMN WCM_REASONFORREPAIR nvarchar(4);

INSERT INTO R5APPSETTINGS (AST_NAME, AST_VALUE,AST_DEFAULT) VALUES ('DBVERSION','11200','0');

UPDATE R5APPSETTINGS SET AST_VALUE = '11200' WHERE AST_NAME='DBVERSION';

UPDATE R5APPSETTINGS SET AST_VALUE = '11102' WHERE AST_NAME='CODEVERSION';
