func NewWithDatabaseInstance(sourceUrl string, databaseName string, databaseInstance database.Driver) (*Migrate, error) {
	m := newCommon()
	sourceName, err := schemeFromUrl(sourceUrl)
	if err != nil {
		return nil, err
	}
	m.sourceName = sourceName
	m.databaseName = databaseName
	sourceDrv, err := source.Open(sourceUrl)
	if err != nil {
		return nil, err
	}
	m.sourceDrv = sourceDrv
	m.databaseDrv = databaseInstance
	return m, nil
}
NewWithDatabaseInstance returns a new Migrate instance from a source URL
and an existing database instance. The source URL scheme is defined by each driver.
Use any string that can serve as an identifier during logging as databaseName.
You are responsible for closing the underlying database client if necessary.
package migrate
import (
	"fmt"
	"os"
	"sync"
	"time"
	"github.com/mattes/migrate/database"
	"github.com/mattes/migrate/source"
)
var DefaultPrefetchMigrations = uint(10)
var DefaultLockTimeout = 15 * time.Second
var (
	ErrNoChange    = fmt.Errorf("no change")
	ErrNilVersion  = fmt.Errorf("no migration")
	ErrLocked      = fmt.Errorf("database locked")
	ErrLockTimeout = fmt.Errorf("timeout: can't acquire database lock")
)
type ErrShortLimit struct {
	Short uint
}
func (e ErrShortLimit) Error() string {
	return fmt.Sprintf("limit %v short", e.Short)
}
type ErrDirty struct {
	Version int
}
func (e ErrDirty) Error() string {
	return fmt.Sprintf("Dirty database version %v. Fix and force version.", e.Version)
}
type Migrate struct {
	sourceName   string
	sourceDrv    source.Driver
	databaseName string
	databaseDrv  database.Driver
	Log Logger
	GracefulStop   chan bool
	isGracefulStop bool
	isLockedMu *sync.Mutex
	isLocked   bool
	PrefetchMigrations uint
	LockTimeout time.Duration
}
func New(sourceUrl, databaseUrl string) (*Migrate, error) {
	m := newCommon()
	sourceName, err := schemeFromUrl(sourceUrl)
	if err != nil {
		return nil, err
	}
	m.sourceName = sourceName
	databaseName, err := schemeFromUrl(databaseUrl)
	if err != nil {
		return nil, err
	}
	m.databaseName = databaseName
	sourceDrv, err := source.Open(sourceUrl)
	if err != nil {
		return nil, err
	}
	m.sourceDrv = sourceDrv
	databaseDrv, err := database.Open(databaseUrl)
	if err != nil {
		return nil, err
	}
	m.databaseDrv = databaseDrv
	return m, nil
}