diff --git a/backend/windmill-api-workspaces/src/workspaces.rs b/backend/windmill-api-workspaces/src/workspaces.rs index 28c5d13cc0..871d739eb3 100644 --- a/backend/windmill-api-workspaces/src/workspaces.rs +++ b/backend/windmill-api-workspaces/src/workspaces.rs @@ -4827,8 +4827,6 @@ pub struct CompareSummary { pub variables_changed: usize, pub resource_types_changed: usize, pub folders_changed: usize, - pub datatables_changed: usize, - pub ducklakes_changed: usize, pub conflicts: usize, // Items that are both ahead and behind } @@ -5003,11 +5001,6 @@ async fn compare_workspaces( } } - // Compare workspace settings (datatables, ducklakes) entry by entry - let settings_diffs = - compare_workspace_settings(&db, &source_workspace_id, &fork_workspace_id).await?; - confirmed_diffs.extend(settings_diffs); - let visible_diffs = filter_visible_diffs( &confirmed_diffs, &source_workspace_id, @@ -5042,14 +5035,6 @@ async fn compare_workspaces( .filter(|s| s.kind == "resource_type") .count(), folders_changed: visible_diffs.iter().filter(|s| s.kind == "folder").count(), - datatables_changed: visible_diffs - .iter() - .filter(|s| s.kind == "datatable") - .count(), - ducklakes_changed: visible_diffs - .iter() - .filter(|s| s.kind == "ducklake") - .count(), conflicts: visible_diffs .iter() .filter(|s| s.ahead > 0 && s.behind > 0) @@ -5202,8 +5187,6 @@ async fn query_visible_items<'c>( .fetch_all(&mut **tx) .await? } - // Datatables and ducklakes are workspace settings, always visible - "datatable" | "ducklake" => paths_vec, _ => vec![], // Unknown kind }; @@ -5222,134 +5205,6 @@ struct ItemComparison { exists_in_fork: bool, } -/// Compare datatable and ducklake workspace settings between source and fork, -/// returning individual diff rows per entry. -async fn compare_workspace_settings( - db: &DB, - source_workspace_id: &str, - fork_workspace_id: &str, -) -> Result> { - let settings = sqlx::query!( - "SELECT workspace_id, datatable, ducklake FROM workspace_settings WHERE workspace_id = ANY($1)", - &[source_workspace_id.to_string(), fork_workspace_id.to_string()] - ) - .fetch_all(db) - .await?; - - let source_settings = settings - .iter() - .find(|s| s.workspace_id == source_workspace_id); - let fork_settings = settings - .iter() - .find(|s| s.workspace_id == fork_workspace_id); - - let mut diffs = vec![]; - - // Compare datatables - let source_datatables: HashMap = source_settings - .and_then(|s| s.datatable.as_ref()) - .and_then(|v| v.get("datatables")) - .and_then(|v| serde_json::from_value(v.clone()).ok()) - .unwrap_or_default(); - let fork_datatables: HashMap = fork_settings - .and_then(|s| s.datatable.as_ref()) - .and_then(|v| v.get("datatables")) - .and_then(|v| serde_json::from_value(v.clone()).ok()) - .unwrap_or_default(); - - let all_dt_keys: std::collections::HashSet<&String> = source_datatables - .keys() - .chain(fork_datatables.keys()) - .collect(); - for key in all_dt_keys { - let in_source = source_datatables.contains_key(key); - let in_fork = fork_datatables.contains_key(key); - // Skip if either side is tagged as nonDiffable - let source_non_diffable = source_datatables - .get(key) - .and_then(|v| v.get("nonDiffable")) - .and_then(|v| v.as_bool()) - .unwrap_or(false); - let fork_non_diffable = fork_datatables - .get(key) - .and_then(|v| v.get("nonDiffable")) - .and_then(|v| v.as_bool()) - .unwrap_or(false); - if source_non_diffable || fork_non_diffable { - continue; - } - let has_changes = match (source_datatables.get(key), fork_datatables.get(key)) { - (Some(a), Some(b)) => a != b, - _ => true, - }; - if has_changes { - diffs.push(WorkspaceDiffRow { - kind: "datatable".to_string(), - path: key.clone(), - ahead: if in_source && (!in_fork || has_changes) { - 1 - } else { - 0 - }, - behind: if in_fork && (!in_source || has_changes) { - 1 - } else { - 0 - }, - has_changes: Some(true), - exists_in_source: Some(in_source), - exists_in_fork: Some(in_fork), - }); - } - } - - // Compare ducklakes - let source_ducklakes: HashMap = source_settings - .and_then(|s| s.ducklake.as_ref()) - .and_then(|v| v.get("ducklakes")) - .and_then(|v| serde_json::from_value(v.clone()).ok()) - .unwrap_or_default(); - let fork_ducklakes: HashMap = fork_settings - .and_then(|s| s.ducklake.as_ref()) - .and_then(|v| v.get("ducklakes")) - .and_then(|v| serde_json::from_value(v.clone()).ok()) - .unwrap_or_default(); - - let all_dl_keys: std::collections::HashSet<&String> = source_ducklakes - .keys() - .chain(fork_ducklakes.keys()) - .collect(); - for key in all_dl_keys { - let in_source = source_ducklakes.contains_key(key); - let in_fork = fork_ducklakes.contains_key(key); - let has_changes = match (source_ducklakes.get(key), fork_ducklakes.get(key)) { - (Some(a), Some(b)) => a != b, - _ => true, - }; - if has_changes { - diffs.push(WorkspaceDiffRow { - kind: "ducklake".to_string(), - path: key.clone(), - ahead: if in_source && (!in_fork || has_changes) { - 1 - } else { - 0 - }, - behind: if in_fork && (!in_source || has_changes) { - 1 - } else { - 0 - }, - has_changes: Some(true), - exists_in_source: Some(in_source), - exists_in_fork: Some(in_fork), - }); - } - } - - Ok(diffs) -} - async fn compare_two_scripts( db: &DB, source_workspace_id: &str, diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index e19ff12b17..ca096a91ef 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -24081,7 +24081,7 @@ components: kind: type: string enum: - ["script", "flow", "app", "resource", "variable", "resource_type", "folder", "datatable", "ducklake"] + ["script", "flow", "app", "resource", "variable", "resource_type"] description: Type of the item path: type: string @@ -24115,8 +24115,6 @@ components: - variables_changed - resource_types_changed - folders_changed - - datatables_changed - - ducklakes_changed - conflicts properties: total_diffs: @@ -24149,12 +24147,6 @@ components: folders_changed: type: integer description: Number of folders with differences - datatables_changed: - type: integer - description: Number of datatables with differences - ducklakes_changed: - type: integer - description: Number of ducklakes with differences conflicts: type: integer description: Number of items that are both ahead and behind (conflicts) diff --git a/backend/windmill-common/src/workspaces.rs b/backend/windmill-common/src/workspaces.rs index 6b26528c56..6573d54303 100644 --- a/backend/windmill-common/src/workspaces.rs +++ b/backend/windmill-common/src/workspaces.rs @@ -404,13 +404,8 @@ impl Default for DataTableForkBehavior { } #[derive(Deserialize, Serialize, Debug)] -#[serde(rename_all = "camelCase")] pub struct DataTable { pub database: DataTableDatabase, - #[serde(default, skip_serializing_if = "std::ops::Not::not")] - pub non_diffable: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub forked_from: Option, } #[derive(Deserialize, Serialize, Debug)]