diff --git a/helpers/lotOccupancyDB/cleanupDatabase.js b/helpers/lotOccupancyDB/cleanupDatabase.js index 0414d394..8648d396 100644 --- a/helpers/lotOccupancyDB/cleanupDatabase.js +++ b/helpers/lotOccupancyDB/cleanupDatabase.js @@ -105,7 +105,8 @@ export const cleanupDatabase = (requestSession) => { " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyFees)" + " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyFields)" + " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyOccupants)" + - " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyTransactions)") + " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyTransactions)" + + " and lotOccupancyId not in (select lotOccupancyId from WorkOrderLotOccupancies)") .run(recordDelete_timeMillisMin).changes; inactivedRecordCount += database .prepare("update Fees" + @@ -173,7 +174,8 @@ export const cleanupDatabase = (requestSession) => { .prepare("delete from Lots where recordDelete_timeMillis <= ?" + " and lotId not in (select lotId from LotComments)" + " and lotId not in (select lotId from LotFields)" + - " and lotId not in (select lotId from LotOccupancies)") + " and lotId not in (select lotId from LotOccupancies)" + + " and lotId not in (select lotId from WorkOrderLots)") .run(recordDelete_timeMillisMin).changes; purgedRecordCount += database .prepare("delete from LotStatuses where recordDelete_timeMillis <= ?" + diff --git a/helpers/lotOccupancyDB/cleanupDatabase.ts b/helpers/lotOccupancyDB/cleanupDatabase.ts index d934bddf..a93f73bb 100644 --- a/helpers/lotOccupancyDB/cleanupDatabase.ts +++ b/helpers/lotOccupancyDB/cleanupDatabase.ts @@ -179,7 +179,8 @@ export const cleanupDatabase = (requestSession: recordTypes.PartialSession) => { " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyFees)" + " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyFields)" + " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyOccupants)" + - " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyTransactions)" + " and lotOccupancyId not in (select lotOccupancyId from LotOccupancyTransactions)" + + " and lotOccupancyId not in (select lotOccupancyId from WorkOrderLotOccupancies)" ) .run(recordDelete_timeMillisMin).changes; @@ -298,7 +299,8 @@ export const cleanupDatabase = (requestSession: recordTypes.PartialSession) => { "delete from Lots where recordDelete_timeMillis <= ?" + " and lotId not in (select lotId from LotComments)" + " and lotId not in (select lotId from LotFields)" + - " and lotId not in (select lotId from LotOccupancies)" + " and lotId not in (select lotId from LotOccupancies)" + + " and lotId not in (select lotId from WorkOrderLots)" ) .run(recordDelete_timeMillisMin).changes;