refactor: type DataTable.forked_from as DataTableForkedFrom struct
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -902,7 +902,7 @@ async fn drop_forked_datatable_databases(
|
||||
if let Err(e) = windmill_common::drop_custom_instance_database(db, db_to_drop).await {
|
||||
tracing::error!("Failed to drop instance database '{}': {}", db_to_drop, e);
|
||||
}
|
||||
} else if let Some(original_resource) = forked_from.get("original_resource") {
|
||||
} else if let Some(original_resource) = &forked_from.original_resource {
|
||||
// Connect to the original resource's database to run DROP on the forked db
|
||||
let pg = match serde_json::from_value::<PgDatabase>(original_resource.clone()) {
|
||||
Ok(pg) => pg,
|
||||
|
||||
@@ -407,7 +407,20 @@ impl Default for DataTableForkBehavior {
|
||||
pub struct DataTable {
|
||||
pub database: DataTableDatabase,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub forked_from: Option<serde_json::Value>,
|
||||
pub forked_from: Option<DataTableForkedFrom>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct DataTableForkedFrom {
|
||||
/// Original instance database name (instance datatables only)
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub original_dbname: Option<String>,
|
||||
/// Original resource value before fork (resource datatables only)
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub original_resource: Option<serde_json::Value>,
|
||||
/// Schema snapshot at fork time
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub schema: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user