Update main.go, main.go, and 5 more files...

This commit is contained in:
RamiBerm
2021-07-14 17:32:55 +03:00
parent 8400e9e903
commit 8886590ea2
6 changed files with 74 additions and 16 deletions

View File

@@ -7,6 +7,7 @@ import (
"gorm.io/gorm/logger"
"mizuserver/pkg/models"
"mizuserver/pkg/utils"
"time"
)
const (
@@ -44,7 +45,7 @@ func GetEntriesTable() *gorm.DB {
func initDataBase(databasePath string) *gorm.DB {
temp, _ := gorm.Open(sqlite.Open(databasePath), &gorm.Config{
Logger: logger.Default.LogMode(logger.Silent),
Logger: &utils.TruncatingLogger{LogLevel: logger.Warn, SlowThreshold: 500 * time.Millisecond},
})
_ = temp.AutoMigrate(&models.MizuEntry{}) // this will ensure table is created
return temp