You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(storage): decompose monolithic LocalDb into Repository pattern and MigrationRunner #1502
lib/core/storage/local_db.dart is currently 1,342 lines long and acts as a monolithic God Object. It combines multiple distinct domain responsibilities:
Schema Migrations: Schema creation and incremental upgrade logic across 13 versions (_onCreate, _onUpgrade, WAL / foreign key pragmas).
Folders Storage: Managing folder hierarchies, nesting, reordering, and folder-connection associations.
Query History: Recording, querying, filtering, and pruning SQL statement history.
Pinned Objects: Managing starred/pinned tables and collections per connection.
This coupling violates the Single Responsibility Principle, makes unit testing difficult without mounting a live SQLite database, and creates concurrency contention bottlenecks.
Scope
Decompose local_db.dart into dedicated single-responsibility repositories under lib/core/storage/:
LocalDbMigrationRunner (or DatabaseMigrationService): Encapsulates onCreate, onUpgrade (v1 through v13) and pragma configurations.
Keep LocalDb as a lightweight facade (or gradually migrate callers to the repositories directly) to preserve backward compatibility during the transition.
Acceptance
local_db.dart reduced to a lightweight facade or removed in favor of repositories.
Schema migration logic isolated in a testable migration runner with automated upgrade tests.
Existing storage unit and integration tests remain 100% green.
Fixed on dev by 7869ce1: refactor(storage): split LocalDb into a schema and per-area repositories (#1502) (#1721). It reaches main with the next dev to main merge (closed after checking the code and its tests).
Activity
refactor(storage): split LocalDb into a schema and per-area repositor…
ZhuchkaTriplesix commentedon Oct 25, 2026
Fixed on dev by 7869ce1: refactor(storage): split LocalDb into a schema and per-area repositories (#1502) (#1721). It reaches main with the next dev to main merge (closed after checking the code and its tests).