Skip to content

Commit

Permalink
fix: open source db in read-only mode in upgarder
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Nov 30, 2022
1 parent 217fae2 commit 7f0a7ea
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/upgrades/from_v1_0_0_to_v2_0_0/upgrader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ const NUMBER_OF_ARGUMENTS: i64 = 3;

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

fn print_usage() {
Expand Down Expand Up @@ -96,8 +96,9 @@ pub async fn upgrade(args: &Arguments) {
.await;
}

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

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

0 comments on commit 7f0a7ea

Please sign in to comment.