mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-11 23:50:04 +01:00
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:
parent
5e128ae6a6
commit
24705c5d01
6 changed files with 65 additions and 3 deletions
21
main.go
21
main.go
|
|
@ -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()
|
||||
}),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue