diff --git a/cmd/goose/main.go b/cmd/goose/main.go deleted file mode 100644 index 63c576f..0000000 --- a/cmd/goose/main.go +++ /dev/null @@ -1,37 +0,0 @@ -package main - -import ( - "fmt" - "os" - - "github.com/eduardolat/pgbackweb/internal/config" -) - -const migrationsFolder string = "./internal/database/migrations" - -func main() { - if len(os.Args) < 2 { - fmt.Println("goose command is required") - fmt.Println("example: task goose -- up") - return - } - - gooseCmd := "" - for i, arg := range os.Args { - if i == 0 { - continue - } - gooseCmd += arg + " " - } - - env := config.GetEnv(true) - - cmd := fmt.Sprintf( - "goose -dir %s postgres \"%s\" %s", - migrationsFolder, - *env.PBW_POSTGRES_CONN_STRING, - gooseCmd, - ) - - fmt.Println(cmd) -} diff --git a/taskfile.yaml b/taskfile.yaml index f7acf83..1f684e8 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -60,7 +60,12 @@ tasks: - task serve goose: - cmd: eval $(go run ./cmd/goose/. {{.CLI_ARGS}}) + silent: true + cmd: > + goose + -dir ./internal/database/migrations + postgres "{{.PBW_POSTGRES_CONN_STRING}}" + {{.CLI_ARGS}} gen-db: cmd: sqlc generate