postgresql

This commit is contained in:
2023-12-20 23:09:12 +03:00
parent 872217d845
commit 89046d130c
14 changed files with 336 additions and 4 deletions

25
cmd/cli/goose.go Normal file
View 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
},
}