Motivation & Problem
In lib/core/database/sqlite_connection.dart (lines 47–53), SQLite databases are opened with PRAGMA foreign_keys = ON;, but without configuring PRAGMA busy_timeout:
onOpen: (db) async {
if (!readOnly) {
await db.execute('PRAGMA foreign_keys = ON');
}
},
When an SQLite database file is concurrently accessed by another thread, external process, or background task, transactions and queries immediately fail with DatabaseException(database is locked / SQLITE_BUSY).
Proposed Solution
- In
SqliteConnection.connect(), configure PRAGMA busy_timeout = 5000; (and PRAGMA foreign_keys = ON;) during database initialization.
- Add unit tests verifying that
busy_timeout is applied on connection initialization.
Acceptance Criteria
Motivation & Problem
In
lib/core/database/sqlite_connection.dart(lines 47–53), SQLite databases are opened withPRAGMA foreign_keys = ON;, but without configuringPRAGMA busy_timeout:When an SQLite database file is concurrently accessed by another thread, external process, or background task, transactions and queries immediately fail with
DatabaseException(database is locked / SQLITE_BUSY).Proposed Solution
SqliteConnection.connect(), configurePRAGMA busy_timeout = 5000;(andPRAGMA foreign_keys = ON;) during database initialization.busy_timeoutis applied on connection initialization.Acceptance Criteria
PRAGMA busy_timeout = 5000;upon connection open.test/core/database/andtest/features/sql_workspaces/pass.