set journal WAL in connection string, not command

This commit is contained in:
sentriz
2020-04-24 20:18:29 +01:00
parent b95f98ffcf
commit e966fffc21

View File

@@ -20,6 +20,7 @@ var (
// with this, the db sleeps for a little while when locked. can prevent // with this, the db sleeps for a little while when locked. can prevent
// a SQLITE_BUSY. see https://www.sqlite.org/c3ref/busy_timeout.html // a SQLITE_BUSY. see https://www.sqlite.org/c3ref/busy_timeout.html
"_busy_timeout": []string{"30000"}, "_busy_timeout": []string{"30000"},
"_journal_mode": []string{"WAL"},
} }
) )
@@ -35,7 +36,6 @@ func New(path string) (*DB, error) {
} }
db.SetLogger(log.New(os.Stdout, "gorm ", 0)) db.SetLogger(log.New(os.Stdout, "gorm ", 0))
db.DB().SetMaxOpenConns(dbMaxOpenConns) db.DB().SetMaxOpenConns(dbMaxOpenConns)
db.Exec("PRAGMA journal_mode=WAL;")
migr := gormigrate.New(db, gormigrate.DefaultOptions, []*gormigrate.Migration{ migr := gormigrate.New(db, gormigrate.DefaultOptions, []*gormigrate.Migration{
&migrationInitSchema, &migrationInitSchema,
&migrationCreateInitUser, &migrationCreateInitUser,