mirror of https://github.com/pressly/goose.git
migrate: fix off-by-one comparison, and print correct versions
parent
e3112d5a4f
commit
8af5b84677
1
cmd.go
1
cmd.go
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
// "fmt"
|
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ func runMigrations(conf *DBConf, migrationsDir string, target int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("goose: migrating db configuration '%v', current version: %d, target: %d\n",
|
fmt.Printf("goose: migrating db configuration '%v', current version: %d, target: %d\n",
|
||||||
conf.Name, mm.Versions[0], mm.Versions[len(mm.Versions)-1])
|
conf.Name, current, target)
|
||||||
|
|
||||||
for _, v := range mm.Versions {
|
for _, v := range mm.Versions {
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ func versionFilter(v, current, target int) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
if target < current {
|
if target < current {
|
||||||
return v <= current && v >= target
|
return v <= current && v > target
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue