it is now properly working, properly saving stuff

This commit is contained in:
filipriec
2025-03-08 11:53:40 +01:00
parent 8ad2179d86
commit 6ae5b11f84

View File

@@ -19,7 +19,17 @@ fn validate_target_column(
let columns: Vec<String> = serde_json::from_value(table_columns.clone())
.map_err(|e| format!("Invalid column data: {}", e))?;
if !columns.iter().any(|c| c == target) {
// Extract column names from the format "\"column_name\" TYPE"
let column_names: Vec<&str> = columns
.iter()
.filter_map(|c| {
c.split_whitespace()
.next()
.map(|s| s.trim_matches('"'))
})
.collect();
if !column_names.contains(&target) {
return Err(format!("Target column {} not defined in table {}", target, table_name));
}