From 4b31981a5410eb17dad9171fee0453d3b6d3b425 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Wed, 9 Oct 2024 16:25:02 +0530 Subject: [PATCH] chore: update external_id lookup --- api/v1/types.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/v1/types.go b/api/v1/types.go index b74c7a20..598b9c9e 100644 --- a/api/v1/types.go +++ b/api/v1/types.go @@ -7,7 +7,6 @@ import ( "github.com/flanksource/config-db/utils" "github.com/google/uuid" - "github.com/lib/pq" "gorm.io/gorm" ) @@ -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) }