Skip to content

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

chore: return environment by the order (#4598)

Danny Xu64cfcd817658
diff --git a/backend/store/environment.go b/backend/store/environment.go
index 8c8f532ad3..15c1f46cfb 100644
--- a/backend/store/environment.go
+++ b/backend/store/environment.go
@@ -404,7 +404,7 @@ func listEnvironmentImplV2(ctx context.Context, tx *Tx, find *FindEnvironmentMes
}
var environments []*EnvironmentMessage
- rows, err := tx.QueryContext(ctx, `
+ rows, err := tx.QueryContext(ctx, fmt.Sprintf(`
SELECT
environment.id,
environment.resource_id,
@@ -414,7 +414,8 @@ func listEnvironmentImplV2(ctx context.Context, tx *Tx, find *FindEnvironmentMes
policy.payload
FROM environment
LEFT JOIN policy ON environment.id = policy.resource_id AND policy.resource_type = 'ENVIRONMENT' AND policy.type = 'bb.policy.environment-tier'
- WHERE `+strings.Join(where, " AND "),
+ WHERE %s
+ ORDER BY environment.order ASC`, strings.Join(where, " AND ")),
args...,
)
if err != nil {