Tweak Sqlite connection settings to reduce database locked errors
Related resources: - https://litestream.io/tips/ - https://unixsheikh.com/articles/sqlite-the-only-database-you-will-ever-need-in-most-cases.html
This commit is contained in:
committed by
Frédéric Guillot
parent
e00e2e3789
commit
f084cfa7bd
@@ -72,6 +72,26 @@ class ConfigModel extends SettingModel
|
||||
return DB_DRIVER === 'sqlite' ? filesize(DB_FILENAME) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get database extra options
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDatabaseOptions()
|
||||
{
|
||||
if (DB_DRIVER === 'sqlite') {
|
||||
return [
|
||||
'journal_mode' => $this->db->getConnection()->query('PRAGMA journal_mode')->fetchColumn(),
|
||||
'wal_autocheckpoint' => $this->db->getConnection()->query('PRAGMA wal_autocheckpoint')->fetchColumn(),
|
||||
'synchronous' => $this->db->getConnection()->query('PRAGMA synchronous')->fetchColumn(),
|
||||
'busy_timeout' => $this->db->getConnection()->query('PRAGMA busy_timeout')->fetchColumn(),
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate a token
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user