mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-11 23:50:04 +01:00
parent
ed9e57a4ad
commit
079523c25f
2 changed files with 13 additions and 4 deletions
9
main.go
9
main.go
|
|
@ -55,6 +55,11 @@ func NewApp() *cli.App {
|
|||
Name: "wait",
|
||||
Usage: "wait for the db to become available before executing the subsequent command",
|
||||
},
|
||||
cli.DurationFlag{
|
||||
Name: "wait-timeout",
|
||||
Usage: "timeout for --wait flag",
|
||||
Value: dbmate.DefaultWaitTimeout,
|
||||
},
|
||||
}
|
||||
|
||||
app.Commands = []cli.Command{
|
||||
|
|
@ -177,6 +182,10 @@ func action(f func(*dbmate.DB, *cli.Context) error) cli.ActionFunc {
|
|||
db.MigrationsDir = c.GlobalString("migrations-dir")
|
||||
db.SchemaFile = c.GlobalString("schema-file")
|
||||
db.WaitBefore = c.GlobalBool("wait")
|
||||
overrideTimeout := c.GlobalDuration("wait-timeout")
|
||||
if overrideTimeout != 0 {
|
||||
db.WaitTimeout = overrideTimeout
|
||||
}
|
||||
|
||||
return f(db, c)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue