Skip to content

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

fix: should able to archive the environment when there is no active instance in that environment (#1756)

tianzhou0851543058ea
diff --git a/server/environment.go b/server/environment.go
index 97378a39fc..964c36fa3d 100644
--- a/server/environment.go
+++ b/server/environment.go
@@ -75,10 +75,10 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {
// Ensure the environment has no instance before it's archived.
if v := envPatch.RowStatus; v != nil && *v == string(api.Archived) {
- archivedStatus := api.Archived
+ normalStatus := api.Normal
instances, err := s.store.FindInstance(ctx, &api.InstanceFind{
EnvironmentID: &id,
- RowStatus: &archivedStatus,
+ RowStatus: &normalStatus,
})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("Failed to find instances in the environment %d", id)).SetInternal(err)