adding verbose output for statement execution (#138)

* adding verbose output for statement execution

* fixing lint and redefined v flag

* changing name due to inherited verbose flag and updating README

* linting

* moving verbose flag to subcommand, removing driver verbose, adding tests

* fixing README, cleaning up spacing
This commit is contained in:
Viswesh Periyasamy 2020-06-25 12:26:09 -07:00 committed by GitHub
parent 5e128ae6a6
commit 24705c5d01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 65 additions and 3 deletions

21
main.go
View file

@ -75,7 +75,14 @@ func NewApp() *cli.App {
{
Name: "up",
Usage: "Create database (if necessary) and migrate to the latest version",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "verbose, v",
Usage: "print the result of each statement execution",
},
},
Action: action(func(db *dbmate.DB, c *cli.Context) error {
db.Verbose = c.Bool("verbose")
return db.CreateAndMigrate()
}),
},
@ -96,7 +103,14 @@ func NewApp() *cli.App {
{
Name: "migrate",
Usage: "Migrate to the latest version",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "verbose, v",
Usage: "print the result of each statement execution",
},
},
Action: action(func(db *dbmate.DB, c *cli.Context) error {
db.Verbose = c.Bool("verbose")
return db.Migrate()
}),
},
@ -104,7 +118,14 @@ func NewApp() *cli.App {
Name: "rollback",
Aliases: []string{"down"},
Usage: "Rollback the most recent migration",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "verbose, v",
Usage: "print the result of each statement execution",
},
},
Action: action(func(db *dbmate.DB, c *cli.Context) error {
db.Verbose = c.Bool("verbose")
return db.Rollback()
}),
},