From 5ce2cae4fffadb98a4fe7aa9f30dea8467e7f35f Mon Sep 17 00:00:00 2001 From: LukeGus Date: Fri, 14 Nov 2025 20:26:59 -0600 Subject: [PATCH] fix: Unable to delete hosts --- src/backend/database/routes/ssh.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/backend/database/routes/ssh.ts b/src/backend/database/routes/ssh.ts index aeb69458..45336a2f 100644 --- a/src/backend/database/routes/ssh.ts +++ b/src/backend/database/routes/ssh.ts @@ -10,6 +10,7 @@ import { fileManagerShortcuts, sshFolders, commandHistory, + recentActivity, } from "../db/schema.js"; import { eq, and, desc, isNotNull, or } from "drizzle-orm"; import type { Request, Response } from "express"; @@ -929,6 +930,24 @@ router.delete( ), ); + await db + .delete(sshCredentialUsage) + .where( + and( + eq(sshCredentialUsage.hostId, numericHostId), + eq(sshCredentialUsage.userId, userId), + ), + ); + + await db + .delete(recentActivity) + .where( + and( + eq(recentActivity.hostId, numericHostId), + eq(recentActivity.userId, userId), + ), + ); + // Now delete the host itself await db .delete(sshData)