postgresql
This commit is contained in:
25
cmd/cli/goose.go
Normal file
25
cmd/cli/goose.go
Normal file
@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"gitea.home.4it.me/dilap54/platiparser/gorm"
|
||||
"github.com/pressly/goose"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
commands = append(commands, gooseCommand)
|
||||
}
|
||||
|
||||
var gooseCommand = &cli.Command{
|
||||
Name: "goose",
|
||||
Action: func(c *cli.Context) error {
|
||||
db, err := gorm.GetDB().DB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := goose.Run(c.Args().First(), db, "./migrations", c.Args().Tail()...); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user