Skip to content

Commit

Permalink
feat: add NewWithSourceAndDatabaseInstance constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
uvulpos committed Jun 8, 2023
1 parent 315a205 commit 845b88a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ func NewWithSourceInstance(sourceName string, sourceInstance source.Driver, data
return m, nil
}

func NewWithSourceAndDatabaseInstance(sourceName string, sourceInstance source.Driver, databaseName string, databaseInstance database.Driver) (*Migrate, error) {
m := newCommon()

m.databaseName = databaseName
m.sourceName = sourceName
m.databaseDrv = databaseInstance
m.sourceDrv = sourceInstance

return m, nil
}

// NewWithInstance returns a new Migrate instance from an existing source and
// database instance. Use any string that can serve as an identifier during logging
// as sourceName and databaseName. You are responsible for closing down
Expand Down

0 comments on commit 845b88a

Please sign in to comment.