package main import ( "log" "git.xeserv.us/xena/route/internal/database/dmigrations" "github.com/caarlos0/env" "github.com/mattes/migrate" _ "github.com/mattes/migrate/database/postgres" bindata "github.com/mattes/migrate/source/go-bindata" ) type config struct { DatabaseURL string `env:"DATABASE_URL,required"` } func main() { var cfg config err := env.Parse(&cfg) if err != nil { log.Fatal(err) } s := bindata.Resource(dmigrations.AssetNames(), func(name string) ([]byte, error) { return dmigrations.Asset(name) }) d, err := bindata.WithInstance(s) if err != nil { log.Fatal(err) } m, err := migrate.NewWithSourceInstance("go-bindata", d, cfg.DatabaseURL) if err != nil { log.Fatal(err) } err = m.Up() if err != nil { log.Fatal(err) } }