mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-06 04:02:16 +00:00
refactor: remove unused mount-related logic from postgres router
- Removed the findMountsByApplicationId and updateMount functions from the postgres router as they are no longer needed after the recent refactor of the getMountPath function. - Cleaned up the code to streamline the update process for PostgreSQL instances.
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
|||||||
deployPostgres,
|
deployPostgres,
|
||||||
findBackupsByDbId,
|
findBackupsByDbId,
|
||||||
findEnvironmentById,
|
findEnvironmentById,
|
||||||
findMountsByApplicationId,
|
|
||||||
findPostgresById,
|
findPostgresById,
|
||||||
findProjectById,
|
findProjectById,
|
||||||
getMountPath,
|
getMountPath,
|
||||||
@@ -18,7 +17,6 @@ import {
|
|||||||
startServiceRemote,
|
startServiceRemote,
|
||||||
stopService,
|
stopService,
|
||||||
stopServiceRemote,
|
stopServiceRemote,
|
||||||
updateMount,
|
|
||||||
updatePostgresById,
|
updatePostgresById,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
@@ -370,24 +368,6 @@ export const postgresRouter = createTRPCRouter({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rest.dockerImage) {
|
|
||||||
const mountPath = getMountPath(rest.dockerImage);
|
|
||||||
const mounts = await findMountsByApplicationId(postgresId, "postgres");
|
|
||||||
if (!mounts || mounts.length === 0) {
|
|
||||||
throw new TRPCError({
|
|
||||||
code: "NOT_FOUND",
|
|
||||||
message: "Mount not found for this Postgres",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
for (const mount of mounts) {
|
|
||||||
if (mount.mountPath.startsWith("/var/lib/postgresql")) {
|
|
||||||
await updateMount(mount.mountId, {
|
|
||||||
mountPath: mountPath,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const service = await updatePostgresById(postgresId, {
|
const service = await updatePostgresById(postgresId, {
|
||||||
...rest,
|
...rest,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user