mirror of https://github.com/pressly/goose.git
DownTo returns error if no matching migration file is found (#314)
parent
b51d50131b
commit
630ef77c33
8
down.go
8
down.go
|
@ -54,11 +54,15 @@ func DownTo(db *sql.DB, dir string, version int64, opts ...OptionsFunc) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
current, err := migrations.Current(currentVersion)
|
if currentVersion == 0 {
|
||||||
if err != nil {
|
|
||||||
log.Printf("goose: no migrations to run. current version: %d\n", currentVersion)
|
log.Printf("goose: no migrations to run. current version: %d\n", currentVersion)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
current, err := migrations.Current(currentVersion)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("goose: migration file not found for current version (%d), error: %s\n", currentVersion, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if current.Version <= version {
|
if current.Version <= version {
|
||||||
log.Printf("goose: no migrations to run. current version: %d\n", currentVersion)
|
log.Printf("goose: no migrations to run. current version: %d\n", currentVersion)
|
||||||
|
|
Loading…
Reference in New Issue