From 700076f2785d8b61826eb327da4aca83e847036d Mon Sep 17 00:00:00 2001 From: CityFun <31820853+zhengkunwang223@users.noreply.github.com> Date: Wed, 16 Jul 2025 17:47:27 +0800 Subject: [PATCH] feat: Application installation supports existing remote databases (#9531) --- agent/app/service/app_utils.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agent/app/service/app_utils.go b/agent/app/service/app_utils.go index 0b2befa16..e94fece87 100644 --- a/agent/app/service/app_utils.go +++ b/agent/app/service/app_utils.go @@ -256,6 +256,9 @@ func createLink(ctx context.Context, installTask *task.Task, app model.App, appI switch database.Type { case constant.AppPostgresql, constant.AppPostgres, constant.AppPostgresqlCluster: oldPostgresqlDb, _ := postgresqlRepo.Get(repo.WithByName(dbConfig.DbName), repo.WithByFrom(constant.ResourceLocal)) + if oldPostgresqlDb.ID == 0 { + oldPostgresqlDb, _ = postgresqlRepo.Get(repo.WithByName(dbConfig.DbName), repo.WithByFrom(constant.AppResourceRemote)) + } resourceId = oldPostgresqlDb.ID if oldPostgresqlDb.ID > 0 { if oldPostgresqlDb.Username != dbConfig.DbUser || oldPostgresqlDb.Password != dbConfig.Password {