feat(sql-file): import split SQL ZIP packages with bounded extraction
This commit is contained in:
1 parent
f43bf80015
commit
b0d30e6f73
22 files changed
+550
-118
No files matched your search
@@ -1288,6 +1288,8 @@ INSERT INTO install_check (id) VALUES (1), (2);
|
||||
.into_owned(),
|
||||
continue_on_error: false,
|
||||
selected_tables: None,
|
||||
part_cooldown_ms: 0,
|
||||
skip_relational_constraints: false,
|
||||
};
|
||||
|
||||
let _ = execute_sql_statement(
|
||||
@@ -1374,6 +1376,8 @@ INSERT INTO children (parent_id) VALUES (LAST_INSERT_ID());
|
||||
.into_owned(),
|
||||
continue_on_error: false,
|
||||
selected_tables: None,
|
||||
part_cooldown_ms: 0,
|
||||
skip_relational_constraints: false,
|
||||
};
|
||||
|
||||
let _ = execute_sql_statement(
|
||||
@@ -1444,6 +1448,8 @@ async fn live_sql_file_import_preserves_raw_mysql_binary_literal_bytes() {
|
||||
file_path: std::env::temp_dir().join(format!("mysql-binary-dump-{suffix}.sql")).to_string_lossy().into_owned(),
|
||||
continue_on_error: false,
|
||||
selected_tables: None,
|
||||
part_cooldown_ms: 0,
|
||||
skip_relational_constraints: false,
|
||||
};
|
||||
|
||||
tokio::fs::write(&request.file_path, script).await.unwrap();
|
||||
|
||||
@@ -76,6 +76,8 @@ async fn live_mysql_selected_table_restore_preserves_unselected_tables() {
|
||||
let request = SqlFileRequest {
|
||||
execution_id: format!("restore-{suffix}-{compressed}"), connection_id: connection_id.clone(), database: database.clone(), file_path: path.display().to_string(), continue_on_error: false,
|
||||
selected_tables: Some(vec![SqlFileTable { database: Some(database.clone()), name: "chosen".into() }]),
|
||||
part_cooldown_ms: 0,
|
||||
skip_relational_constraints: false,
|
||||
};
|
||||
execute_sql_file_path(&state, &request, &path, CancellationToken::new(), std::time::Instant::now(), |_| {}).await?;
|
||||
let rows = execute_sql_statement(&state, &connection_id, &database, "SELECT id, LENGTH(body) FROM chosen", None, None).await?;
|
||||
@@ -90,6 +92,8 @@ async fn live_mysql_selected_table_restore_preserves_unselected_tables() {
|
||||
let request = SqlFileRequest {
|
||||
execution_id: format!("invalid-{suffix}"), connection_id: connection_id.clone(), database: database.clone(), file_path: path.display().to_string(), continue_on_error: true,
|
||||
selected_tables: Some(vec![SqlFileTable { database: None, name: "chosen".into() }]),
|
||||
part_cooldown_ms: 0,
|
||||
skip_relational_constraints: false,
|
||||
};
|
||||
let mut events = Vec::new();
|
||||
assert!(execute_sql_file_path(&state, &request, &path, CancellationToken::new(), std::time::Instant::now(), |event| events.push(event)).await.is_err());
|
||||
@@ -171,6 +175,8 @@ async fn live_mysql_database_export_restores_dependent_views() {
|
||||
file_path: file_path.to_string_lossy().to_string(),
|
||||
continue_on_error: false,
|
||||
selected_tables: None,
|
||||
part_cooldown_ms: 0,
|
||||
skip_relational_constraints: false,
|
||||
};
|
||||
execute_sql_file_path(
|
||||
&state,
|
||||
|
||||
@@ -150,6 +150,8 @@ async fn live_postgres_all_schema_export_restores_one_sql_file() {
|
||||
file_path: export_path.display().to_string(),
|
||||
continue_on_error: false,
|
||||
selected_tables: None,
|
||||
part_cooldown_ms: 0,
|
||||
skip_relational_constraints: false,
|
||||
},
|
||||
&export_path,
|
||||
CancellationToken::new(),
|
||||
|
||||
@@ -1295,6 +1295,8 @@ async fn live_sqlserver_sql_file_import_executes_go_batches() {
|
||||
file_path: "fixture.sql".to_string(),
|
||||
continue_on_error: false,
|
||||
selected_tables: None,
|
||||
part_cooldown_ms: 0,
|
||||
skip_relational_constraints: false,
|
||||
};
|
||||
let done_seen = AtomicBool::new(false);
|
||||
|
||||
|
||||
Reference in new issue
Block a user