You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
608 B
32 lines
608 B
package main
|
|
|
|
import (
|
|
"git.aiterp.net/lucifer/new-server/app/config"
|
|
"github.com/pressly/goose"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
db := config.DBX().DB
|
|
|
|
log.Printf("Target version: %s", time.Now().Format("20060102150405"))
|
|
log.Printf("Database: %s:%d/%s", config.MySqlHost(), config.MySqlPort(), config.MySqlSchema())
|
|
log.Printf("Authenticating as: %s", config.MySqlUsername())
|
|
|
|
err := goose.SetDialect("mysql")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
cmd := os.Getenv("GOOSE_COMMAND")
|
|
if cmd == "" {
|
|
cmd = "up"
|
|
}
|
|
|
|
err = goose.Run(cmd, db, "./scripts")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|