func NewWithInstance(sourceName string, sourceInstance source.Driver, databaseName string, databaseInstance database.Driver) (*Migrate, error) {
	m := newCommon()
	m.sourceName = sourceName
	m.databaseName = databaseName
	m.sourceDrv = sourceInstance
	m.databaseDrv = databaseInstance
	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
the underlying source and 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
}
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
}
func NewWithSourceInstance(sourceName string, sourceInstance source.Driver, databaseUrl string) (*Migrate, error) {
	m := newCommon()
	databaseName, err := schemeFromUrl(databaseUrl)
	if err != nil {
		return nil, err
	}
	m.databaseName = databaseName
	m.sourceName = sourceName
	databaseDrv, err := database.Open(databaseUrl)
	if err != nil {
		return nil, err
	}
	m.databaseDrv = databaseDrv
	m.sourceDrv = sourceInstance
	return m, nil
}