Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore(api): never return the deleted backups to users in v1 api (#4786)

h3n4lc25df0df5e53
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index 9dde6d4fd1..451c1d0da1 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -412,8 +412,10 @@ func (s *DatabaseService) ListBackup(ctx context.Context, request *v1pb.ListBack
return nil, status.Errorf(codes.NotFound, "database %q not found", databaseName)
}
+ rowStatus := api.Normal
existedBackupList, err := s.store.ListBackupV2(ctx, &store.FindBackupMessage{
DatabaseUID: &database.UID,
+ RowStatus: &rowStatus,
})
if err != nil {
return nil, status.Errorf(codes.Internal, err.Error())
diff --git a/backend/store/backup.go b/backend/store/backup.go
index 5143ffce48..4a53e8f2fb 100644
--- a/backend/store/backup.go
+++ b/backend/store/backup.go
@@ -619,6 +619,7 @@ func (s *Store) ListBackupV2(ctx context.Context, find *FindBackupMessage) ([]*B
if err := tx.Commit(); err != nil {
return nil, errors.Wrapf(err, "failed to commit transaction")
}
+
return backupList, nil
}
@@ -686,6 +687,7 @@ func (s *Store) UpdateBackupV2(ctx context.Context, patch *UpdateBackupMessage)
if err := json.Unmarshal(payload, &backup.Payload); err != nil {
return nil, err
}
+
return &backup, nil
}