mirror of
https://github.com/LukeHagar/dokploy.git
synced 2025-12-06 04:19:37 +00:00
feat(deployment): add 'cancelled' status to deployment and implement cancellation logic
- Updated the deployment status enum to include 'cancelled'. - Added a new utility function to handle the cancellation of deployments, setting their status to 'error'. - Enhanced the status tooltip component to display 'Cancelled' when the status is 'cancelled'. - Created a new SQL migration to add the 'cancelled' value to the deploymentStatus type.
This commit is contained in:
@@ -21,6 +21,7 @@ export const deploymentStatus = pgEnum("deploymentStatus", [
|
||||
"running",
|
||||
"done",
|
||||
"error",
|
||||
"cancelled",
|
||||
]);
|
||||
|
||||
export const deployments = pgTable("deployment", {
|
||||
|
||||
@@ -68,6 +68,7 @@ export * from "./utils/backups/postgres";
|
||||
export * from "./utils/backups/utils";
|
||||
export * from "./utils/backups/web-server";
|
||||
export * from "./utils/builders/compose";
|
||||
export * from "./utils/startup/cancell-deployments";
|
||||
export * from "./utils/builders/docker-file";
|
||||
export * from "./utils/builders/drop";
|
||||
export * from "./utils/builders/heroku";
|
||||
|
||||
17
packages/server/src/utils/startup/cancell-deployments.ts
Normal file
17
packages/server/src/utils/startup/cancell-deployments.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { deployments } from "@dokploy/server/db/schema";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { db } from "../../db/index";
|
||||
|
||||
export const initCancelDeployments = async () => {
|
||||
try {
|
||||
console.log("Setting up cancel deployments....");
|
||||
|
||||
const result = await db.update(deployments).set({
|
||||
status: "error",
|
||||
}).where(eq(deployments.status, "cancelled"));
|
||||
|
||||
console.log(`Cancelled ${result.length} deployments`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user