diff --git a/pkg/datastore/gormstore/script_policy.go b/pkg/datastore/gormstore/script_policy.go index d8dbb97..fb9aef1 100644 --- a/pkg/datastore/gormstore/script_policy.go +++ b/pkg/datastore/gormstore/script_policy.go @@ -26,7 +26,7 @@ func (env *ScriptPolicy) Get(ctx context.Context, id int64) (model.ScriptPolicy, func (env *ScriptPolicy) GetFromHash(ctx context.Context, hash uint64) (model.ScriptPolicy, error) { var mdl model.ScriptPolicy - if err := env.db.Model(&model.ScriptPolicy{}).Where("hash = ?", hash).Error; err != nil { + if err := env.db.Take(&mdl,"from_script_hash = ?", hash).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return mdl, datastore.ErrNotExist }