mirror of
https://github.com/andwati/dokploy.git
synced 2026-10-18 03:02:56 +00:00
fix(application): remove preview deployments when deleting an application
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
|||||||
deleteAllMiddlewares,
|
deleteAllMiddlewares,
|
||||||
findApplicationById,
|
findApplicationById,
|
||||||
findEnvironmentById,
|
findEnvironmentById,
|
||||||
|
findPreviewDeploymentsByApplicationId,
|
||||||
findProjectById,
|
findProjectById,
|
||||||
getAccessibleServerIds,
|
getAccessibleServerIds,
|
||||||
getApplicationStats,
|
getApplicationStats,
|
||||||
@@ -16,6 +17,7 @@ import {
|
|||||||
removeDeployments,
|
removeDeployments,
|
||||||
removeDirectoryCode,
|
removeDirectoryCode,
|
||||||
removeMonitoringDirectory,
|
removeMonitoringDirectory,
|
||||||
|
removePreviewDeployment,
|
||||||
removeService,
|
removeService,
|
||||||
removeTraefikConfig,
|
removeTraefikConfig,
|
||||||
startService,
|
startService,
|
||||||
@@ -234,6 +236,15 @@ export const applicationRouter = createTRPCRouter({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const previewDeploymentsList =
|
||||||
|
await findPreviewDeploymentsByApplicationId(input.applicationId);
|
||||||
|
|
||||||
|
for (const previewDeployment of previewDeploymentsList) {
|
||||||
|
try {
|
||||||
|
await removePreviewDeployment(previewDeployment.previewDeploymentId);
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
|
||||||
const result = await db
|
const result = await db
|
||||||
.delete(applications)
|
.delete(applications)
|
||||||
.where(eq(applications.applicationId, input.applicationId))
|
.where(eq(applications.applicationId, input.applicationId))
|
||||||
|
|||||||
Reference in New Issue
Block a user