Skip to content

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

chore: compare index (#10136)

Danny Xu78c714dd543f
diff --git a/backend/api/v1/branch_service.go b/backend/api/v1/branch_service.go
index 05a931edd5..d9c93252a9 100644
--- a/backend/api/v1/branch_service.go
+++ b/backend/api/v1/branch_service.go
@@ -7,9 +7,9 @@ import (
"io"
"log/slog"
"path"
+ "slices"
"strings"
- "golang.org/x/exp/slices"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb"
@@ -931,5 +931,32 @@ func equalTable(s, t *storepb.TableMetadata) bool {
return false
}
}
+ for i := 0; i < len(s.GetIndexes()); i++ {
+ si, ti := s.GetIndexes()[i], t.GetIndexes()[i]
+ if si.GetName() != ti.GetName() {
+ return false
+ }
+ if si.GetDefinition() != ti.GetDefinition() {
+ return false
+ }
+ if si.GetPrimary() != ti.GetPrimary() {
+ return false
+ }
+ if si.GetUnique() != ti.GetUnique() {
+ return false
+ }
+ if si.GetType() != ti.GetType() {
+ return false
+ }
+ if si.GetVisible() != ti.GetVisible() {
+ return false
+ }
+ if si.GetComment() != ti.GetComment() {
+ return false
+ }
+ if !slices.Equal(si.GetExpressions(), ti.GetExpressions()) {
+ return false
+ }
+ }
return true
}