mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-06 14:35:26 +02:00
22 lines
500 B
TypeScript
22 lines
500 B
TypeScript
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: "cancelled",
|
|
})
|
|
.where(eq(deployments.status, "running"))
|
|
.returning();
|
|
|
|
console.log(`Cancelled ${result.length} deployments`);
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
};
|