fix(sql): handle database drag and routine export
This commit is contained in:
5 files changed
+152
-15
No files matched your search
@@ -5,6 +5,7 @@ use std::io::Write;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use crate::models::connection::DatabaseType;
|
||||
use crate::object_source_sql::build_export_object_source_sql;
|
||||
use crate::sql_dialect::{qualified_table_name, quote_table_identifier, uses_single_row_insert_statements};
|
||||
use crate::transfer::{
|
||||
format_ch_array_sql_literal, format_pg_array_sql_literal, is_identity_column_extra, quote_identifier,
|
||||
@@ -1224,8 +1225,10 @@ pub async fn export_database_sql_core(
|
||||
.await
|
||||
{
|
||||
Ok(obj_source) => {
|
||||
if !obj_source.source.is_empty() {
|
||||
writeln!(file, "{};\n", obj_source.source).map_err(|e| format!("Failed to write file: {e}"))?;
|
||||
let source =
|
||||
build_export_object_source_sql(db_type, crate::db::ObjectSourceKind::View, &obj_source.source);
|
||||
if !source.is_empty() {
|
||||
writeln!(file, "{source}\n").map_err(|e| format!("Failed to write file: {e}"))?;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -1265,8 +1268,13 @@ pub async fn export_database_sql_core(
|
||||
.await
|
||||
{
|
||||
Ok(obj_source) => {
|
||||
if !obj_source.source.is_empty() {
|
||||
writeln!(file, "{};\n", obj_source.source).map_err(|e| format!("Failed to write file: {e}"))?;
|
||||
let source = build_export_object_source_sql(
|
||||
db_type,
|
||||
crate::db::ObjectSourceKind::Procedure,
|
||||
&obj_source.source,
|
||||
);
|
||||
if !source.is_empty() {
|
||||
writeln!(file, "{source}\n").map_err(|e| format!("Failed to write file: {e}"))?;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -1306,8 +1314,13 @@ pub async fn export_database_sql_core(
|
||||
.await
|
||||
{
|
||||
Ok(obj_source) => {
|
||||
if !obj_source.source.is_empty() {
|
||||
writeln!(file, "{};\n", obj_source.source).map_err(|e| format!("Failed to write file: {e}"))?;
|
||||
let source = build_export_object_source_sql(
|
||||
db_type,
|
||||
crate::db::ObjectSourceKind::Function,
|
||||
&obj_source.source,
|
||||
);
|
||||
if !source.is_empty() {
|
||||
writeln!(file, "{source}\n").map_err(|e| format!("Failed to write file: {e}"))?;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
|
||||
Reference in new issue
Block a user