fix: only upgrade those that use default pg path

This commit is contained in:
Bima42
2025-11-18 19:47:29 +01:00
parent 8ca8839d7e
commit d08fdeb939
+3 -3
View File
@@ -42,9 +42,7 @@ import { cancelJobs } from "@/server/utils/backup";
function getMountPath(dockerImage: string): string { function getMountPath(dockerImage: string): string {
const versionMatch = dockerImage.match(/postgres:(\d+)/); const versionMatch = dockerImage.match(/postgres:(\d+)/);
const version = versionMatch?.[1] const version = versionMatch?.[1] ? Number.parseInt(versionMatch[1], 10) : 18;
? Number.parseInt(versionMatch[1], 10)
: 18;
return `/var/lib/postgresql/${version}/data`; return `/var/lib/postgresql/${version}/data`;
} }
@@ -388,11 +386,13 @@ export const postgresRouter = createTRPCRouter({
}); });
} }
for (const mount of mounts) { for (const mount of mounts) {
if (mount.mountPath.startsWith("/var/lib/postgresql")) {
await updateMount(mount.mountId, { await updateMount(mount.mountId, {
mountPath: mountPath, mountPath: mountPath,
}); });
} }
} }
}
const service = await updatePostgresById(postgresId, { const service = await updatePostgresById(postgresId, {
...rest, ...rest,