mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-11 23:50:04 +01:00
Add --wait flag (#112)
✨ When using dbmate as a container, since the base image is distroless, we can't do `dbmate up && dbmate wait`, which makes config a bit more cumbersome (e.g. in kubernetes an extra initContainer). Closes #111 Closes #112
This commit is contained in:
parent
98066fadaa
commit
1e45bd774c
4 changed files with 107 additions and 0 deletions
5
main.go
5
main.go
|
|
@ -50,6 +50,10 @@ func NewApp() *cli.App {
|
|||
Name: "no-dump-schema",
|
||||
Usage: "don't update the schema file on migrate/rollback",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "wait",
|
||||
Usage: "wait for the db to become available before executing the subsequent command",
|
||||
},
|
||||
}
|
||||
|
||||
app.Commands = []cli.Command{
|
||||
|
|
@ -139,6 +143,7 @@ func action(f func(*dbmate.DB, *cli.Context) error) cli.ActionFunc {
|
|||
db.AutoDumpSchema = !c.GlobalBool("no-dump-schema")
|
||||
db.MigrationsDir = c.GlobalString("migrations-dir")
|
||||
db.SchemaFile = c.GlobalString("schema-file")
|
||||
db.WaitBefore = c.GlobalBool("wait")
|
||||
|
||||
return f(db, c)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue