feat: Application installation supports existing remote databases (#9531)

This commit is contained in:
CityFun 2025-07-16 17:47:27 +08:00 committed by GitHub
parent 7bf1bf61a7
commit 700076f278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {