diff --git a/analytics/graph_record.go b/analytics/graph_record.go index 494fda6f1..e99fdbf8e 100644 --- a/analytics/graph_record.go +++ b/analytics/graph_record.go @@ -7,11 +7,10 @@ import ( "encoding/json" "errors" "fmt" + "github.com/buger/jsonparser" "io/ioutil" "net/http" - "github.com/buger/jsonparser" - "github.com/TykTechnologies/graphql-go-tools/pkg/ast" "github.com/TykTechnologies/graphql-go-tools/pkg/astnormalization" "github.com/TykTechnologies/graphql-go-tools/pkg/astparser" @@ -39,7 +38,12 @@ type GraphRecord struct { HasErrors bool `gorm:"has_errors"` } +// TableName is used by both the sql orm and mongo driver the table name and collection name used for operations on this model +// the conditional return is to ensure the right value is used for both the sql and mongo operations func (g *GraphRecord) TableName() string { + if GraphSQLTableName == "" { + return g.AnalyticsRecord.TableName() + } return GraphSQLTableName }