mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-25 23:16:18 +01:00
fix(database): reopen SQLite at the current data folder
SQLiteDatabase resolved its file once, in __init__. open() then created the directory of the current storage_path but connected to the old file. Database keeps the backend while the provider stays the same, so after a data folder change and a reopen, EOS kept reading and writing the database of the old folder. LMDB resolves its directory on every open and was not affected. Tests showed it as order dependence: test_count_records[SQLite] found the five records of test_load_records_with_range[SQLite] when both ran in a row. Under pytest-xdist, ten SQLite tests failed this way. open() now resolves the file from the current storage_path, like LMDB. Refs #1553 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: SchaafAlexander <86607129+SchaafAlexander@users.noreply.github.com> Assisted-by: Claude Code (claude-fable-5-2)
This commit is contained in:
committed by
Bobby Noelte
co-authored by
Claude Fable 5.2
parent
00a39f75bf
commit
ce7fb96faf
@@ -688,6 +688,9 @@ class SQLiteDatabase(DatabaseBackendABC):
|
||||
if self.is_open:
|
||||
return
|
||||
|
||||
# Resolve the file on every open, like LMDB does with its directory: the
|
||||
# data folder may have changed since this backend was created.
|
||||
self.db_file = self.storage_path / "data.db"
|
||||
self.storage_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
self.conn = sqlite3.connect(
|
||||
|
||||
Reference in New Issue
Block a user