diff --git a/db/collection_index.go b/db/collection_index.go index 791817a0a3..44f221a78c 100644 --- a/db/collection_index.go +++ b/db/collection_index.go @@ -120,8 +120,8 @@ func (c *collection) collectIndexedFields() []client.FieldDescription { fieldsMap := make(map[string]client.FieldDescription) for _, index := range c.indexes { for _, field := range index.Description().Fields { - for i := range c.desc.Schema.Fields { - colField := c.desc.Schema.Fields[i] + for i := range c.Schema().Fields { + colField := c.Schema().Fields[i] if field.Name == colField.Name { fieldsMap[field.Name] = colField break @@ -297,8 +297,8 @@ func (c *collection) indexExistingDocs( ) error { fields := make([]client.FieldDescription, 0, 1) for _, field := range index.Description().Fields { - for i := range c.desc.Schema.Fields { - colField := c.desc.Schema.Fields[i] + for i := range c.Schema().Fields { + colField := c.Schema().Fields[i] if field.Name == colField.Name { fields = append(fields, colField) break @@ -422,7 +422,7 @@ func (c *collection) checkExistingFields( ctx context.Context, fields []client.IndexedFieldDescription, ) error { - collectionFields := c.Description().Schema.Fields + collectionFields := c.Schema().Fields for _, field := range fields { found := false for _, colField := range collectionFields { diff --git a/db/collection_update.go b/db/collection_update.go index 8c7bbff7f3..c68902db44 100644 --- a/db/collection_update.go +++ b/db/collection_update.go @@ -303,13 +303,13 @@ func (c *collection) applyMergeToDoc( }) for mfield, mval := range mergeMap { - fd, isValidField := c.desc.Schema.GetField(mfield) + fd, isValidField := c.Schema().GetField(mfield) if !isValidField { return client.NewErrFieldNotExist(mfield) } if fd.Kind == client.FieldKind_FOREIGN_OBJECT { - fd, isValidField = c.desc.Schema.GetField(mfield + request.RelatedObjectID) + fd, isValidField = c.Schema().GetField(mfield + request.RelatedObjectID) if !isValidField { return client.NewErrFieldNotExist(mfield) } @@ -335,7 +335,7 @@ func (c *collection) isSecondaryIDField(fieldDesc client.FieldDescription) (clie return client.FieldDescription{}, false } - relationFieldDescription, valid := c.Description().Schema.GetField( + relationFieldDescription, valid := c.Schema().GetField( strings.TrimSuffix(fieldDesc.Name, request.RelatedObjectID), ) return relationFieldDescription, valid && !relationFieldDescription.IsPrimaryRelation() @@ -377,7 +377,7 @@ func (c *collection) patchPrimaryDoc( return client.NewErrFieldNotExist(relationFieldDescription.RelationName) } - primaryIDField, ok := primaryCol.Description().Schema.GetField(primaryField.Name + request.RelatedObjectID) + primaryIDField, ok := primaryCol.Schema().GetField(primaryField.Name + request.RelatedObjectID) if !ok { return client.NewErrFieldNotExist(primaryField.Name + request.RelatedObjectID) }