check related work order tables

deepsource-autofix-76c6eb20
Dan Gowans 2022-10-31 15:45:36 -04:00
parent 302875ee57
commit c5c86b5964
2 changed files with 8 additions and 4 deletions

View File

@ -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 <= ?" +

View File

@ -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;