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
607 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. package main
  2. import (
  3. "git.aiterp.net/lucifer/new-server/app/config"
  4. "github.com/pressly/goose"
  5. "log"
  6. "os"
  7. "time"
  8. )
  9. func main() {
  10. db := config.DBX().DB
  11. log.Printf("Target version: %s",time.Now().Format("20060102150405"))
  12. log.Printf("Database: %s:%d/%s", config.MySqlHost(), config.MySqlPort(), config.MySqlSchema())
  13. log.Printf("Authenticating as: %s", config.MySqlUsername())
  14. err := goose.SetDialect("mysql")
  15. if err != nil {
  16. log.Fatal(err)
  17. }
  18. cmd := os.Getenv("GOOSE_COMMAND")
  19. if cmd == "" {
  20. cmd = "up"
  21. }
  22. err = goose.Run(cmd, db, "./scripts")
  23. if err != nil {
  24. log.Fatal(err)
  25. }
  26. }