Skip to content

Commit

Permalink
Take schema as param to newCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSisley committed Oct 6, 2023
1 parent aac50a3 commit bd561e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions db/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ type collection struct {
// CollectionOptions object.

// NewCollection returns a pointer to a newly instanciated DB Collection
func (db *db) newCollection(desc client.CollectionDescription) (*collection, error) {
func (db *db) newCollection(desc client.CollectionDescription, schema client.SchemaDescription) (*collection, error) {
return &collection{
db: db,
desc: client.CollectionDescription{
ID: desc.ID,
Name: desc.Name,
Schema: desc.Schema,
Schema: schema,
Indexes: desc.Indexes,
},
schema: desc.Schema,
schema: schema,
}, nil
}

Expand Down Expand Up @@ -128,7 +128,7 @@ func (db *db) createCollection(
schema.Fields[i].ID = client.FieldID(i)
}

col, err := db.newCollection(desc)
col, err := db.newCollection(desc, schema)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion db/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (db *db) patchSchema(ctx context.Context, txn datastore.Txn, patchString st
newCollections := []client.CollectionDefinition{}
newSchemaByName := map[string]client.SchemaDescription{}
for _, desc := range newDescriptionsByName {
col, err := db.newCollection(desc)
col, err := db.newCollection(desc, desc.Schema)
if err != nil {
return err
}
Expand Down

0 comments on commit bd561e0

Please sign in to comment.