make configurable wal auto checkpoint (#2242)
This commit is contained in:
parent
dc17b4d378
commit
64bb56352f
3 changed files with 14 additions and 6 deletions
|
@ -543,10 +543,10 @@ func openDB(cfg types.DatabaseConfig) (*gorm.DB, error) {
|
|||
}
|
||||
|
||||
if cfg.Sqlite.WriteAheadLog {
|
||||
if err := db.Exec(`
|
||||
if err := db.Exec(fmt.Sprintf(`
|
||||
PRAGMA journal_mode=WAL;
|
||||
PRAGMA wal_autocheckpoint=0;
|
||||
`).Error; err != nil {
|
||||
PRAGMA wal_autocheckpoint=%d;
|
||||
`, cfg.Sqlite.WALAutoCheckPoint)).Error; err != nil {
|
||||
return nil, fmt.Errorf("setting WAL mode: %w", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue