Skip to content

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

feat: filter db belonging to archived instance (#1483)

qsliubffd471e6178
diff --git a/store/database.go b/store/database.go
index 1b11719f1b..f744480a3d 100644
--- a/store/database.go
+++ b/store/database.go
@@ -92,6 +92,19 @@ func (s *Store) FindDatabase(ctx context.Context, find *api.DatabaseFind) ([]*ap
}
databaseList = append(databaseList, database)
}
+
+ // If no specified instance, filter out databases belonging to archived instances.
+ if find.InstanceID == nil {
+ var filteredList []*api.Database
+ for _, database := range databaseList {
+ if i := database.Instance; i == nil || i.RowStatus == api.Archived {
+ continue
+ }
+ filteredList = append(filteredList, database)
+ }
+ databaseList = filteredList
+ }
+
return databaseList, nil
}