feat(schema-diff): professional DDL diff view with deployment-aware colors and custom themes (#1112)
Co-authored-by: Sam <14344444@@qq.com>
This commit is contained in:
1 parent
2554ed95be
commit
ef5ed05ae7
41 files changed
+5695
-1215
No files matched your search
@@ -39,9 +39,8 @@ pub async fn list_objects(
|
||||
connection_id: String,
|
||||
database: String,
|
||||
schema: String,
|
||||
object_types: Option<Vec<String>>,
|
||||
) -> Result<Vec<db::ObjectInfo>, String> {
|
||||
dbx_core::schema::list_objects_core(&state, &connection_id, &database, &schema, object_types).await
|
||||
dbx_core::schema::list_objects_core(&state, &connection_id, &database, &schema).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@@ -120,3 +119,44 @@ pub async fn get_table_ddl(
|
||||
) -> Result<String, String> {
|
||||
dbx_core::schema::get_table_ddl_core(&state, &connection_id, &database, &schema, &table).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_functions(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
database: String,
|
||||
schema: String,
|
||||
) -> Result<Vec<db::FunctionInfo>, String> {
|
||||
dbx_core::schema::list_functions_core(&state, &connection_id, &database, &schema).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_sequences(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
database: String,
|
||||
schema: String,
|
||||
with_last_values: bool,
|
||||
) -> Result<Vec<db::SequenceInfo>, String> {
|
||||
dbx_core::schema::list_sequences_core(&state, &connection_id, &database, &schema, with_last_values).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_rules(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
database: String,
|
||||
schema: String,
|
||||
) -> Result<Vec<db::RuleInfo>, String> {
|
||||
dbx_core::schema::list_rules_core(&state, &connection_id, &database, &schema).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_owners(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
database: String,
|
||||
schema: String,
|
||||
) -> Result<Vec<db::OwnerInfo>, String> {
|
||||
dbx_core::schema::list_owners_core(&state, &connection_id, &database, &schema).await
|
||||
}
|
||||
@@ -8,8 +8,22 @@ pub fn prepare_schema_diff(
|
||||
#[tauri::command]
|
||||
pub fn generate_schema_sync_sql(
|
||||
diffs: Vec<dbx_core::schema_diff::TableDiff>,
|
||||
function_diffs: Option<Vec<dbx_core::schema_diff::FunctionDiff>>,
|
||||
sequence_diffs: Option<Vec<dbx_core::schema_diff::SequenceDiff>>,
|
||||
rule_diffs: Option<Vec<dbx_core::schema_diff::RuleDiff>>,
|
||||
owner_diffs: Option<Vec<dbx_core::schema_diff::OwnerDiff>>,
|
||||
database_type: dbx_core::models::connection::DatabaseType,
|
||||
target_schema: Option<String>,
|
||||
cascade_delete: Option<bool>,
|
||||
) -> Result<String, String> {
|
||||
Ok(dbx_core::schema_diff::generate_schema_sync_sql(&diffs, database_type, target_schema.as_deref()))
|
||||
Ok(dbx_core::schema_diff::generate_schema_sync_sql(
|
||||
&diffs,
|
||||
function_diffs.as_deref().unwrap_or_default(),
|
||||
sequence_diffs.as_deref().unwrap_or_default(),
|
||||
rule_diffs.as_deref().unwrap_or_default(),
|
||||
owner_diffs.as_deref().unwrap_or_default(),
|
||||
database_type,
|
||||
target_schema.as_deref(),
|
||||
cascade_delete.unwrap_or(false),
|
||||
))
|
||||
}
|
||||
Reference in new issue
Block a user