diff --git a/db/db.go b/db/db.go index a80b600..99c588b 100644 --- a/db/db.go +++ b/db/db.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path" + "log" "gorm.io/driver/sqlite" @@ -18,6 +19,7 @@ func Init() (*gorm.DB, error) { // github.com/mattn/go-sqlite3 configPath := os.Getenv("CONFIG") dbPath := path.Join(configPath, "podgrab.db") + log.Println(dbPath) db, err := gorm.Open(sqlite.Open(dbPath), &gorm.Config{}) if err != nil { fmt.Println("db err: ", err) diff --git a/main.go b/main.go index 631b34a..075225c 100644 --- a/main.go +++ b/main.go @@ -23,9 +23,9 @@ func main() { db.DB, err = db.Init() if err != nil { fmt.Println("statuse: ", err) + }else{ + db.Migrate() } - db.Migrate() - r := gin.Default() dataPath := os.Getenv("DATA") //r.Static("/assets", "./assets")