allow to specify migrations table

pull/196/head
Ilia Kondrashov 2019-12-14 19:44:40 +02:00
parent e42e49944b
commit f3abc85fac
2 changed files with 5 additions and 1 deletions

View File

@ -64,6 +64,8 @@ Options:
-dir string
directory with migration files (default ".")
-table string
migrations table name (default "goose_db_version")
-h print help
-v enable verbose mode
-version

View File

@ -11,7 +11,8 @@ import (
var (
flags = flag.NewFlagSet("goose", flag.ExitOnError)
dir = flags.String("dir", ".", "directory with migration files")
dir = flags.String("dir", "", "directory with migration files")
table = flags.String("table", "goose_db_version", "migrations table name")
verbose = flags.Bool("v", false, "enable verbose mode")
help = flags.Bool("h", false, "print help")
version = flags.Bool("version", false, "print version")
@ -28,6 +29,7 @@ func main() {
if *verbose {
goose.SetVerbose(true)
}
goose.SetTableName(*table)
args := flags.Args()
if len(args) == 0 || *help {