diff --git a/db/collection.go b/db/collection.go index 230067e6d8..e2634dc9dd 100644 --- a/db/collection.go +++ b/db/collection.go @@ -56,8 +56,6 @@ type collection struct { colID uint32 - schemaID string - desc client.CollectionDescription schema client.SchemaDescription @@ -153,7 +151,6 @@ func (db *db) createCollection( return nil, err } schemaID := cid.String() - col.schemaID = schemaID // For new schemas the initial version id will match the schema id schemaVersionID := schemaID @@ -640,11 +637,10 @@ func (db *db) getCollectionByVersionID( } col := &collection{ - db: db, - desc: desc, - schema: desc.Schema, - colID: desc.ID, - schemaID: desc.Schema.SchemaID, + db: db, + desc: desc, + schema: desc.Schema, + colID: desc.ID, } err = col.loadIndexes(ctx, txn) @@ -816,7 +812,7 @@ func (c *collection) ID() uint32 { } func (c *collection) SchemaID() string { - return c.schemaID + return c.Schema().SchemaID } // WithTxn returns a new instance of the collection, with a transaction @@ -828,7 +824,6 @@ func (c *collection) WithTxn(txn datastore.Txn) client.Collection { desc: c.desc, schema: c.schema, colID: c.colID, - schemaID: c.schemaID, indexes: c.indexes, fetcherFactory: c.fetcherFactory, } @@ -1113,7 +1108,7 @@ func (c *collection) save( events.Update{ DocKey: doc.Key().String(), Cid: headNode.Cid(), - SchemaID: c.schemaID, + SchemaID: c.Schema().SchemaID, Block: headNode, Priority: priority, }, diff --git a/db/collection_delete.go b/db/collection_delete.go index 480656849f..3903717e18 100644 --- a/db/collection_delete.go +++ b/db/collection_delete.go @@ -281,7 +281,7 @@ func (c *collection) applyDelete( events.Update{ DocKey: key.DocKey, Cid: headNode.Cid(), - SchemaID: c.schemaID, + SchemaID: c.Schema().SchemaID, Block: headNode, Priority: priority, },