diff --git a/crates/dbx-core/src/cloud_sync.rs b/crates/dbx-core/src/cloud_sync.rs index a2ca0912e0..6bcc446810 100644 --- a/crates/dbx-core/src/cloud_sync.rs +++ b/crates/dbx-core/src/cloud_sync.rs @@ -617,6 +617,7 @@ mod tests { connect_timeout_secs: 5, expose_lan: false, use_ssh_agent: false, + ssh_agent_sock_path: String::new(), })], connect_timeout_secs: 5, query_timeout_secs: 30, diff --git a/crates/dbx-core/src/connection_secrets.rs b/crates/dbx-core/src/connection_secrets.rs index 21305ecdcb..75fcce1819 100644 --- a/crates/dbx-core/src/connection_secrets.rs +++ b/crates/dbx-core/src/connection_secrets.rs @@ -752,6 +752,7 @@ mod tests { connect_timeout_secs: 5, expose_lan: false, use_ssh_agent: false, + ssh_agent_sock_path: String::new(), } } diff --git a/crates/dbx-core/src/database_export.rs b/crates/dbx-core/src/database_export.rs index 3e141cb218..cade6416ca 100644 --- a/crates/dbx-core/src/database_export.rs +++ b/crates/dbx-core/src/database_export.rs @@ -937,6 +937,9 @@ mod tests { }], row_limit_per_table: Some(DATABASE_EXPORT_ROW_LIMIT), insert_batch_size: Some(DATABASE_EXPORT_INSERT_BATCH_SIZE), + connection_id: None, + database: None, + schema: None, }) .unwrap(); diff --git a/crates/dbx-core/src/db/ssh_tunnel.rs b/crates/dbx-core/src/db/ssh_tunnel.rs index d571f9edb3..989bb44262 100644 --- a/crates/dbx-core/src/db/ssh_tunnel.rs +++ b/crates/dbx-core/src/db/ssh_tunnel.rs @@ -823,6 +823,7 @@ mod tests { connect_timeout_secs: 5, expose_lan: false, use_ssh_agent: false, + ssh_agent_sock_path: String::new(), } } diff --git a/crates/dbx-core/src/db/transport_layer_tunnel.rs b/crates/dbx-core/src/db/transport_layer_tunnel.rs index 4d288bcbe2..82cb04741e 100644 --- a/crates/dbx-core/src/db/transport_layer_tunnel.rs +++ b/crates/dbx-core/src/db/transport_layer_tunnel.rs @@ -188,6 +188,7 @@ mod tests { connect_timeout_secs: 5, expose_lan: false, use_ssh_agent: false, + ssh_agent_sock_path: String::new(), }) } diff --git a/crates/dbx-core/src/table_structure_sql/indexes.rs b/crates/dbx-core/src/table_structure_sql/indexes.rs index 6d46eee979..f81abe6197 100644 --- a/crates/dbx-core/src/table_structure_sql/indexes.rs +++ b/crates/dbx-core/src/table_structure_sql/indexes.rs @@ -2,6 +2,7 @@ use super::comments::build_sqlserver_index_comment_sql; use super::dialect::{capabilities_for, database_label, database_type_for_dialect, dialect_label, StructureDialect}; use super::types::{EditableStructureIndex, TableStructureSqlOptions}; use super::util::{clean, qualified_table, quote_ident, quote_string}; +use crate::models::connection::DatabaseType; pub(super) fn build_index_sql(options: &TableStructureSqlOptions, warnings: &mut Vec) -> Vec { let capabilities = capabilities_for(options.database_type); @@ -23,7 +24,13 @@ pub(super) fn build_index_sql(options: &TableStructureSqlOptions, warnings: &mut warnings.push(format!("Primary index \"{}\" cannot be dropped from this editor.", original.name)); continue; } - statements.push(build_drop_index_sql(dialect, &table, options.schema.as_deref(), &original.name)); + statements.push(build_drop_index_sql( + options.database_type, + dialect, + &table, + options.schema.as_deref(), + &original.name, + )); continue; } @@ -40,7 +47,13 @@ pub(super) fn build_index_sql(options: &TableStructureSqlOptions, warnings: &mut warnings.push(format!("Primary index \"{}\" cannot be edited from this editor.", original.name)); continue; } - statements.push(build_drop_index_sql(dialect, &table, options.schema.as_deref(), &original.name)); + statements.push(build_drop_index_sql( + options.database_type, + dialect, + &table, + options.schema.as_deref(), + &original.name, + )); statements.extend(build_create_index_statements( dialect, &table, @@ -104,11 +117,15 @@ pub(super) fn mysql_index_parts(index_type: &str) -> (String, String) { } pub(super) fn build_drop_index_sql( + database_type: Option, dialect: StructureDialect, table: &str, schema: Option<&str>, index_name: &str, ) -> String { + if database_type == Some(DatabaseType::Iris) { + return format!("DROP INDEX {} ON TABLE {table};", quote_ident(dialect, index_name)); + } if matches!(dialect, StructureDialect::Mysql | StructureDialect::SqlServer) { return format!("DROP INDEX {} ON {table};", quote_ident(dialect, index_name)); } diff --git a/crates/dbx-core/src/table_structure_sql/tests.rs b/crates/dbx-core/src/table_structure_sql/tests.rs index 5d58938edf..889b942448 100644 --- a/crates/dbx-core/src/table_structure_sql/tests.rs +++ b/crates/dbx-core/src/table_structure_sql/tests.rs @@ -186,6 +186,37 @@ fn builds_informix_column_and_index_changes() { ); } +#[test] +fn iris_drop_index_includes_table_name() { + let mut old_index = index("index_id", &["ID"]); + old_index.marked_for_drop = true; + old_index.original = Some(IndexInfo { + name: "index_id".to_string(), + columns: vec!["ID".to_string()], + is_unique: false, + is_primary: false, + filter: None, + index_type: None, + included_columns: None, + comment: None, + }); + + let result = build_table_structure_change_sql(TableStructureSqlOptions { + database_type: Some(DatabaseType::Iris), + schema: Some("SQLUSER".to_string()), + table_name: "tb_a".to_string(), + columns: Vec::new(), + indexes: vec![old_index], + foreign_keys: Vec::new(), + triggers: Vec::new(), + table_comment: None, + original_table_comment: None, + }); + + assert_eq!(result.warnings, Vec::::new()); + assert_eq!(result.statements, vec!["DROP INDEX \"index_id\" ON TABLE \"SQLUSER\".\"tb_a\";"]); +} + #[test] fn mysql_create_index_with_comment() { let mut col = column("name");