Closed pauldelucia closed 1 week ago
[!IMPORTANT]
Review skipped
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
The changes in this pull request involve significant modifications to the AppState
struct and the Database
implementation. The AppState
struct's new
method now initializes the Database
with a reference to the database file path. Additionally, the update
method has been updated to enhance the handling of network switching actions. In the Database
implementation, the initialize
method has been altered to manage database file paths, including checks for first-time setups and versioning. New helper methods and constants have been introduced to improve robustness and performance.
File | Change Summary |
---|---|
src/app.rs | - Updated new method in AppState to pass a reference for db_file_path .- Modified update method in AppState to include a call to update_settings for AppAction::SwitchNetwork . |
src/database/initialization.rs | - Changed initialize method to accept db_file_path parameter.- Added methods: is_first_time_setup , is_outdated , backup_and_recreate_db , set_default_version .- Updated constants: MIN_SUPPORTED_DB_VERSION (to 1), DEFAULT_DB_VERSION (to 1), and added DEFAULT_NETWORK ("dash").- Reformatted SQL commands and added new indexes for performance. |
sequenceDiagram
participant AppState
participant Database
participant Context
AppState->>Database: new(db_file_path)
Database->>Database: initialize(db_file_path)
alt First time setup
Database-->>Database: Create tables, set default version
else Outdated database
Database-->>Database: Backup and recreate database
end
AppState->>Context: update(AppAction::SwitchNetwork)
Context->>AppState: update_settings(RootScreenType::RootScreenNetworkChooser)
🐰 "In the code, we hop and play,
With databases bright and gay.
New paths we set, and actions flow,
To make our app a joy to show!
So let’s rejoice, with a cheer and a dance,
For every change, we take a chance!" 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai review
Summary by CodeRabbit
New Features
Bug Fixes
Documentation