From 7170663b6f848111ac49e9fc65a0c30a09a49700 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Sat, 1 Nov 2025 09:50:28 -0300 Subject: [PATCH] feat: remove unused bot config update logic from bootstrap The commit removes the unused bot configuration update functionality from the bootstrap manager. This includes: 1. Removing the fallback logic in component installation that would update bot configs 2. Removing the entire update_bot_config method which was used to insert/update configuration values The code was likely removed because this functionality is no longer needed or has been moved elsewhere in the codebase. The removal simplifies the bootstrap process by eliminating unused database operations. --- src/bootstrap/mod.rs | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/src/bootstrap/mod.rs b/src/bootstrap/mod.rs index 9c91fed7..da424a45 100644 --- a/src/bootstrap/mod.rs +++ b/src/bootstrap/mod.rs @@ -140,19 +140,6 @@ impl BootstrapManager { for component in components { if pm.is_installed(component.name) { pm.start(component.name)?; - } else { - let mut conn = establish_pg_connection()?; - let default_bot_id: uuid::Uuid = diesel::sql_query("SELECT id FROM bots LIMIT 1") - .load::(&mut conn) - .map(|rows| rows.first().map(|r| r.id).unwrap_or_else(|| uuid::Uuid::new_v4())) - .unwrap_or_else(|_| uuid::Uuid::new_v4()); - - if let Err(e) = self.update_bot_config(&default_bot_id, component.name) { - error!( - "Failed to update bot config after installing {}: {}", - component.name, e - ); - } } } @@ -358,30 +345,6 @@ impl BootstrapManager { format!("{:x}", hasher.finalize()) } - fn update_bot_config(&self, bot_id: &uuid::Uuid, component: &str) -> Result<()> { - use diesel::sql_types::{Text, Uuid as SqlUuid}; - let mut conn = establish_pg_connection()?; - - // Ensure globally unique keys and update values atomically - let config_key = format!("{}_{}", bot_id, component); - let config_value = "true".to_string(); - let new_id = uuid::Uuid::new_v4(); - - diesel::sql_query( - "INSERT INTO bot_configuration (id, bot_id, config_key, config_value, config_type) - VALUES ($1, $2, $3, $4, 'string') - ON CONFLICT (config_key) - DO UPDATE SET config_value = EXCLUDED.config_value, updated_at = NOW()", - ) - .bind::(new_id) - .bind::(bot_id) - .bind::(&config_key) - .bind::(&config_value) - .execute(&mut conn)?; - - Ok(()) - } - pub async fn upload_templates_to_drive(&self, _config: &AppConfig) -> Result<()> { let mut conn = establish_pg_connection()?; self.create_bots_from_templates(&mut conn)?;