Skip to content

Commit 19c14b0

Browse files
committed
fix: Pass down args to migrate subcommand
1 parent bd5ae26 commit 19c14b0

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎api/cmd/migrations/main.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"agones-minecraft/config"
1212
)
1313

14-
func Run() error {
14+
func Run(args []string) error {
1515
config.InitConfig()
1616
dbConfig := config.GetDBConfig()
1717

@@ -24,7 +24,7 @@ func Run() error {
2424

2525
flag.Parse()
2626

27-
old, new, err := migrations.Run(db, flag.Args()...)
27+
old, new, err := migrations.Run(db, args...)
2828

2929
if err != nil {
3030
return err

‎api/main.go‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"log"
45
"os"
56

67
"github.com/urfave/cli/v2"
@@ -9,7 +10,7 @@ import (
910
"agones-minecraft/cmd/migrations"
1011
)
1112

12-
func Run() error {
13+
func main() {
1314
app := &cli.App{
1415
Commands: []*cli.Command{
1516
{
@@ -23,11 +24,13 @@ func Run() error {
2324
Name: "migrate",
2425
Usage: "migrate database",
2526
Action: func(c *cli.Context) error {
26-
return migrations.Run()
27+
return migrations.Run(c.Args().Slice())
2728
},
2829
},
2930
},
3031
}
3132

32-
return app.Run(os.Args)
33+
if err := app.Run(os.Args); err != nil {
34+
log.Fatal(err)
35+
}
3336
}

0 commit comments

Comments
 (0)