Skip to content

Commit 7f0a7ea

Browse files
committed
fix: open source db in read-only mode in upgarder
1 parent 217fae2 commit 7f0a7ea

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/upgrades/from_v1_0_0_to_v2_0_0/upgrader.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ const NUMBER_OF_ARGUMENTS: i64 = 3;
3030

3131
#[derive(Debug)]
3232
pub struct Arguments {
33-
source_database_file: String, // The source database in version v1.0.0 we want to migrate
34-
destiny_database_file: String, // The new migrated database in version v2.0.0
35-
upload_path: String, // The relative dir where torrent files are stored
33+
pub source_database_file: String, // The source database in version v1.0.0 we want to migrate
34+
pub destiny_database_file: String, // The new migrated database in version v2.0.0
35+
pub upload_path: String, // The relative dir where torrent files are stored
3636
}
3737

3838
fn print_usage() {
@@ -96,8 +96,9 @@ pub async fn upgrade(args: &Arguments) {
9696
.await;
9797
}
9898

99-
async fn current_db(connect_url: &str) -> Arc<SqliteDatabaseV1_0_0> {
100-
Arc::new(SqliteDatabaseV1_0_0::new(connect_url).await)
99+
async fn current_db(db_filename: &str) -> Arc<SqliteDatabaseV1_0_0> {
100+
let source_database_connect_url = format!("sqlite://{}?mode=ro", db_filename);
101+
Arc::new(SqliteDatabaseV1_0_0::new(&source_database_connect_url).await)
101102
}
102103

103104
async fn new_db(db_filename: &str) -> Arc<SqliteDatabaseV2_0_0> {

0 commit comments

Comments
 (0)