From ddde9204c72dd867f920f07f6483be03dda7cf68 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Mon, 28 Nov 2022 22:55:14 +0100 Subject: basically update impl; added "good" download; auto dl on new mod; db to 0.4; etc --- src/commands/setup.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/commands/setup.rs') diff --git a/src/commands/setup.rs b/src/commands/setup.rs index be06040..c7f1bed 100644 --- a/src/commands/setup.rs +++ b/src/commands/setup.rs @@ -13,6 +13,7 @@ pub async fn setup(config: Cfg) -> Result<(), Box> { Ok(ver) => { match ver.as_str() { "0.2" => to_03(config)?, + "0.3" => to_04(config)?, _ => return Err(Box::new(Error::new(ErrorKind::Other, "UNKNOWN_VERSION"))) } }, @@ -33,7 +34,7 @@ async fn to_02(config: Cfg) -> Result<(), Box> { for list in lists { println!("Updating {}", list); - s_insert_column(config.clone(), String::from(&list), String::from("current_download"), String::from("TEXT"))?; + s_insert_column(config.clone(), String::from(&list), String::from("current_download"), String::from("TEXT"), None)?; let full_list = lists_get(config.clone(), String::from(&list))?; @@ -53,6 +54,13 @@ async fn to_02(config: Cfg) -> Result<(), Box> { } fn to_03(config: Cfg) -> Result<(), Box> { - s_insert_column(config.clone(), String::from("lists"), String::from("download_folder"), String::from("TEXT"))?; + s_insert_column(config.clone(), String::from("lists"), String::from("download_folder"), String::from("TEXT"), None)?; s_config_update_version(config, String::from("0.3")) } + +fn to_04(config: Cfg) -> Result<(), Box> { + for list_id in lists_get_all_ids(config.clone())? { + s_insert_column(config.clone(), list_id, String::from("disabled_versions"), String::from("TEXT"), Some(String::from("NONE")))?; + } + s_config_update_version(config, String::from("0.4")) +} -- cgit v1.2.3