mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-02-12 15:18:26 -06:00
38 lines
575 B
Go
38 lines
575 B
Go
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)
|
|
}
|