From 2539680ae8ba371fa5430679610ce52f0cf142b4 Mon Sep 17 00:00:00 2001 From: revolyssup Date: Wed, 5 Oct 2022 18:34:49 +0530 Subject: [PATCH 1/2] Change gorm tags for postgres compatibility Signed-off-by: revolyssup --- pkg/model/model.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/model/model.go b/pkg/model/model.go index bd780efe..ccd75635 100644 --- a/pkg/model/model.go +++ b/pkg/model/model.go @@ -50,7 +50,7 @@ type ResourceObjectMeta struct { DeletionGracePeriodSeconds *int64 `json:"deletionGracePeriodSeconds,omitempty"` Labels []*KeyValue `json:"labels,omitempty" gorm:"foreignkey:ID;references:id;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` Annotations []*KeyValue `json:"annotations,omitempty" gorm:"foreignkey:ID;references:id;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` - OwnerReferences string `json:"ownerReferences,omitempty" gorm:"type:json"` + OwnerReferences string `json:"ownerReferences,omitempty" gorm:"type:jsonb"` Finalizers string `json:"finalizers,omitempty" gorm:"type:json"` ClusterName string `json:"clusterName,omitempty"` ManagedFields string `json:"managedFields,omitempty" gorm:"type:json"` @@ -59,12 +59,12 @@ type ResourceObjectMeta struct { type ResourceSpec struct { ID string `json:"id" gorm:"primarykey"` - Attribute string `json:"attribute,omitempty" gorm:"type:json"` + Attribute string `json:"attribute,omitempty"` } type ResourceStatus struct { ID string `json:"id" gorm:"primarykey"` - Attribute string `json:"attribute,omitempty" gorm:"type:json"` + Attribute string `json:"attribute,omitempty"` } func (obj *Object) BeforeCreate(tx *gorm.DB) (err error) { From a9dace8dbac22ccce317c1ad2869ac5d60b2283c Mon Sep 17 00:00:00 2001 From: Pranav Singh Date: Wed, 5 Oct 2022 18:56:25 +0530 Subject: [PATCH 2/2] rm json type from gorm annotation Signed-off-by: Pranav Singh --- pkg/model/model.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/model/model.go b/pkg/model/model.go index ccd75635..7c331b69 100644 --- a/pkg/model/model.go +++ b/pkg/model/model.go @@ -50,10 +50,10 @@ type ResourceObjectMeta struct { DeletionGracePeriodSeconds *int64 `json:"deletionGracePeriodSeconds,omitempty"` Labels []*KeyValue `json:"labels,omitempty" gorm:"foreignkey:ID;references:id;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` Annotations []*KeyValue `json:"annotations,omitempty" gorm:"foreignkey:ID;references:id;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` - OwnerReferences string `json:"ownerReferences,omitempty" gorm:"type:jsonb"` - Finalizers string `json:"finalizers,omitempty" gorm:"type:json"` + OwnerReferences string `json:"ownerReferences,omitempty" gorm:"-"` + Finalizers string `json:"finalizers,omitempty" gorm:"-"` ClusterName string `json:"clusterName,omitempty"` - ManagedFields string `json:"managedFields,omitempty" gorm:"type:json"` + ManagedFields string `json:"managedFields,omitempty" gorm:"-"` ClusterID string `json:"cluster_id"` }