diff --git a/apps/backend/src/app/files/files.service.ts b/apps/backend/src/app/files/files.service.ts index f567a78..161e9b4 100644 --- a/apps/backend/src/app/files/files.service.ts +++ b/apps/backend/src/app/files/files.service.ts @@ -103,6 +103,13 @@ export class FilesService { } if (sameFileInStorage.length === 1) { //if there is one only entry then remove the file from the storage and the database. + await this.database + .use() + .delete(FilesForMachinesTable) + .where(eq(FilesForMachinesTable.fileId, fileId)) + .prepare("deleteFileAssociationFromMachine") + .execute(); + await this.database .use() .delete(FilesTable)