Skip to content

Commit

Permalink
Added DefineSchema method
Browse files Browse the repository at this point in the history
  • Loading branch information
seroukhov committed Apr 3, 2021
1 parent 82a0739 commit 45a1a5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion persistence/IdentifiableMongoDbPersistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ type IdentifiableMongoDbPersistence struct {
func InheritIdentifiableMongoDbPersistence(overrides IMongoDbPersistenceOverrides, proto reflect.Type, collection string) *IdentifiableMongoDbPersistence {
if collection == "" {
panic("Collection name could not be nil")
return nil
}
c := IdentifiableMongoDbPersistence{}
c.MongoDbPersistence = *InheritMongoDbPersistence(overrides, proto, collection)
Expand Down
3 changes: 3 additions & 0 deletions persistence/MongoDbPersistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ func (c *MongoDbPersistence) Open(correlationId string) error {
//ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
//defer cancel()

// Define database schema
c.Overrides.DefineSchema()

// Recreate indexes
if len(c.indexes) > 0 {
keys, errIndexes := c.Collection.Indexes().CreateMany(c.Connection.Ctx, c.indexes, mongoopt.CreateIndexes())
Expand Down

0 comments on commit 45a1a5a

Please sign in to comment.