feat(diff): move schema and data diff to Rust
This commit is contained in:
1 parent
c91fbc9fd6
commit
3f14585a2a
24 files changed
+2251
-950
No files matched your search
@@ -0,0 +1,19 @@
|
||||
use std::sync::Arc;
|
||||
use tauri::State;
|
||||
|
||||
use crate::commands::connection::AppState;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn prepare_data_compare(
|
||||
options: dbx_core::data_compare::DataComparePreparationOptions,
|
||||
) -> Result<dbx_core::data_compare::DataComparePreparation, String> {
|
||||
dbx_core::data_compare::prepare_data_compare(options)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn prepare_data_compare_from_tables(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
options: dbx_core::data_compare::DataCompareFromTablesOptions,
|
||||
) -> Result<dbx_core::data_compare::DataCompareFromTablesPreparation, String> {
|
||||
dbx_core::data_compare::prepare_data_compare_from_tables(&state, options).await
|
||||
}
|
||||
@@ -5,6 +5,7 @@ pub mod connection;
|
||||
#[allow(dead_code, unused_imports)]
|
||||
mod connection_secrets;
|
||||
pub mod csv_export;
|
||||
pub mod data_compare;
|
||||
pub mod database_export;
|
||||
pub mod deep_link;
|
||||
pub mod external_sql;
|
||||
@@ -18,6 +19,7 @@ pub mod redis_cmd;
|
||||
pub mod saved_sql;
|
||||
pub mod schema;
|
||||
pub mod schema_cache;
|
||||
pub mod schema_diff;
|
||||
pub mod sql_file;
|
||||
pub mod system_fonts;
|
||||
pub mod table_import;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#[tauri::command]
|
||||
pub fn prepare_schema_diff(
|
||||
options: dbx_core::schema_diff::SchemaDiffPreparationOptions,
|
||||
) -> Result<dbx_core::schema_diff::SchemaDiffPreparation, String> {
|
||||
Ok(dbx_core::schema_diff::prepare_schema_diff(options))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn generate_schema_sync_sql(
|
||||
diffs: Vec<dbx_core::schema_diff::TableDiff>,
|
||||
database_type: dbx_core::models::connection::DatabaseType,
|
||||
target_schema: Option<String>,
|
||||
) -> Result<String, String> {
|
||||
Ok(dbx_core::schema_diff::generate_schema_sync_sql(&diffs, database_type, target_schema.as_deref()))
|
||||
}
|
||||
@@ -277,6 +277,8 @@ pub fn run() {
|
||||
commands::schema::list_foreign_keys,
|
||||
commands::schema::list_triggers,
|
||||
commands::schema::get_table_ddl,
|
||||
commands::schema_diff::prepare_schema_diff,
|
||||
commands::schema_diff::generate_schema_sync_sql,
|
||||
commands::schema_cache::save_schema_cache,
|
||||
commands::schema_cache::load_schema_cache,
|
||||
commands::schema_cache::delete_schema_cache_prefix,
|
||||
@@ -290,6 +292,8 @@ pub fn run() {
|
||||
commands::query::analyze_sql_references,
|
||||
commands::query::analyze_editable_query_editability,
|
||||
commands::query::prepare_data_grid_save,
|
||||
commands::data_compare::prepare_data_compare,
|
||||
commands::data_compare::prepare_data_compare_from_tables,
|
||||
commands::sql_file::preview_sql_file,
|
||||
commands::sql_file::execute_sql_file,
|
||||
commands::sql_file::cancel_sql_file_execution,
|
||||
|
||||
Reference in new issue
Block a user