Compare commits
2 commits
81766ac5df
...
d55d81f0a3
Author | SHA1 | Date | |
---|---|---|---|
d55d81f0a3 | |||
46dbb7049c |
2 changed files with 14 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
# 0.3.2 / 2024-03-24
|
||||
|
||||
* Fix: Move database logging to stderr
|
||||
|
||||
# 0.3.1 / 2024-03-24
|
||||
|
||||
* Fix: Reduce storage size also for status
|
||||
|
|
|
@ -2,12 +2,16 @@ package database
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/glebarez/sqlite"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -36,6 +40,12 @@ func New(driverName, connString string) (d *DB, err error) {
|
|||
|
||||
db, err := gorm.Open(innerDB, &gorm.Config{
|
||||
DisableForeignKeyConstraintWhenMigrating: true,
|
||||
Logger: logger.New(log.New(os.Stderr, "\r\n", log.LstdFlags), logger.Config{
|
||||
SlowThreshold: time.Second,
|
||||
LogLevel: logger.Warn,
|
||||
IgnoreRecordNotFoundError: true,
|
||||
Colorful: false,
|
||||
}),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "connecting database")
|
||||
|
|
Loading…
Reference in a new issue