Skip to content

Commit

Permalink
chore: update external_id lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed Oct 9, 2024
1 parent 4b7ba4a commit 4b31981
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/flanksource/config-db/utils"

"github.com/google/uuid"
"github.com/lib/pq"

"gorm.io/gorm"
)
Expand Down Expand Up @@ -115,7 +114,7 @@ func (e ExternalID) GetKubernetesUID() string {
}

func (e ExternalID) Find(db *gorm.DB) *gorm.DB {
query := db.Limit(1).Order("updated_at DESC").Where("deleted_at IS NULL").Where("external_id @> ?", pq.StringArray([]string{e.ExternalID}))
query := db.Limit(1).Order("updated_at DESC").Where("deleted_at IS NULL").Where("? = ANY(external_id)", e.ExternalID)
if e.ConfigType != "" {
query = query.Where("type = ?", e.ConfigType)
}
Expand Down

0 comments on commit 4b31981

Please sign in to comment.