@@ -268,7 +268,7 @@ onBeforeUnmount(() => {
- {{ item.label }}
+ {{ item.label }}
{{ key }}
@@ -284,7 +284,7 @@ onBeforeUnmount(() => {
v-if="show && activeSubIndex !== null && items[activeSubIndex]?.children?.length"
ref="subRef"
:style="{ position: 'fixed', left: subX + 'px', top: subY + 'px', zIndex: 10000, maxHeight: 'min(420px, calc(100vh - 16px))' }"
- class="bg-popover text-popover-foreground w-56 max-w-[calc(100vw-16px)] rounded-[6px] p-1 overflow-x-hidden overflow-y-auto ring-1 ring-foreground/10 shadow-lg"
+ class="bg-popover text-popover-foreground min-w-56 w-max max-w-[calc(100vw-16px)] rounded-[6px] p-1 overflow-y-auto ring-1 ring-foreground/10 shadow-lg"
@mouseenter="onSubMouseEnter"
@mouseleave="onSubMouseLeave"
>
@@ -297,7 +297,7 @@ onBeforeUnmount(() => {
- {{ child.label }}
+ {{ child.label }}
{{ key }}
diff --git a/apps/desktop/src/composables/useDataGridExport.ts b/apps/desktop/src/composables/useDataGridExport.ts
index b707c84b13..226c2db993 100644
--- a/apps/desktop/src/composables/useDataGridExport.ts
+++ b/apps/desktop/src/composables/useDataGridExport.ts
@@ -7,7 +7,7 @@ import { useToast } from "@/composables/useToast";
import { displayCellValue, type CellValue } from "@/lib/dataGrid/cellValue";
import { tryStartExclusiveActivation, type ActionActivationGuard } from "@/lib/connection/actionActivation";
import { copyToClipboard } from "@/lib/common/clipboard";
-import { buildDataGridCopyInsertStatement, buildDataGridCopyUpdateStatements, type DataGridTableMeta } from "@/lib/dataGrid/dataGridSql";
+import { buildDataGridCopyInsertStatement, buildDataGridCopyUpdateStatements, type DataGridCopyInsertMode, type DataGridTableMeta } from "@/lib/dataGrid/dataGridSql";
import { formatSqlInsert } from "@/lib/export/exportFormats";
import { uuid } from "@/lib/common/utils";
import { useSettingsStore } from "@/stores/settingsStore";
@@ -102,12 +102,24 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
loading: false,
ready: false,
});
+ const copyRowInsertRowByRowCache = ref({
+ key: "",
+ text: "",
+ loading: false,
+ ready: false,
+ });
const copyRowInsertWithoutPrimaryKeysCache = ref({
key: "",
text: "",
loading: false,
ready: false,
});
+ const copyRowInsertWithoutPrimaryKeysRowByRowCache = ref({
+ key: "",
+ text: "",
+ loading: false,
+ ready: false,
+ });
const copyRowUpdateCache = ref({
key: "",
text: "",
@@ -217,7 +229,7 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
});
}
- function insertCopyKey(excludePrimaryKeys: boolean): string {
+ function insertCopyKey(excludePrimaryKeys: boolean, insertMode: DataGridCopyInsertMode): string {
const rows = copyStatementRowsKey(insertEligibleRows());
return JSON.stringify({
databaseType: databaseType.value ?? null,
@@ -227,6 +239,7 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
columns: columns.value,
sourceColumns: sourceColumns.value ?? null,
excludePrimaryKeys,
+ insertMode,
rows,
});
}
@@ -236,13 +249,22 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
return rows.map((item) => ({ id: item.id, data: item.data }));
}
- function insertCopyCache(excludePrimaryKeys: boolean): CopyStatementCache {
- return excludePrimaryKeys ? copyRowInsertWithoutPrimaryKeysCache.value : copyRowInsertCache.value;
+ function insertCopyCache(excludePrimaryKeys: boolean, insertMode: DataGridCopyInsertMode): CopyStatementCache {
+ if (excludePrimaryKeys) {
+ return insertMode === "row-by-row" ? copyRowInsertWithoutPrimaryKeysRowByRowCache.value : copyRowInsertWithoutPrimaryKeysCache.value;
+ }
+ return insertMode === "row-by-row" ? copyRowInsertRowByRowCache.value : copyRowInsertCache.value;
}
- function setInsertCopyCache(excludePrimaryKeys: boolean, cache: CopyStatementCache) {
+ function setInsertCopyCache(excludePrimaryKeys: boolean, insertMode: DataGridCopyInsertMode, cache: CopyStatementCache) {
if (excludePrimaryKeys) {
- copyRowInsertWithoutPrimaryKeysCache.value = cache;
+ if (insertMode === "row-by-row") {
+ copyRowInsertWithoutPrimaryKeysRowByRowCache.value = cache;
+ } else {
+ copyRowInsertWithoutPrimaryKeysCache.value = cache;
+ }
+ } else if (insertMode === "row-by-row") {
+ copyRowInsertRowByRowCache.value = cache;
} else {
copyRowInsertCache.value = cache;
}
@@ -252,10 +274,10 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
copyRowUpdateCache.value = cache;
}
- async function prefetchRowAsInsertStatement(excludePrimaryKeys: boolean) {
+ async function prefetchRowAsInsertStatement(excludePrimaryKeys: boolean, insertMode: DataGridCopyInsertMode = "merged") {
const rows = insertEligibleRows();
if (!rows.length) {
- setInsertCopyCache(excludePrimaryKeys, {
+ setInsertCopyCache(excludePrimaryKeys, insertMode, {
key: "",
text: "",
loading: false,
@@ -263,11 +285,11 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
});
return;
}
- const key = insertCopyKey(excludePrimaryKeys);
- const current = insertCopyCache(excludePrimaryKeys);
+ const key = insertCopyKey(excludePrimaryKeys, insertMode);
+ const current = insertCopyCache(excludePrimaryKeys, insertMode);
if ((current.loading || current.ready) && current.key === key) return;
- setInsertCopyCache(excludePrimaryKeys, {
+ setInsertCopyCache(excludePrimaryKeys, insertMode, {
key,
text: "",
loading: true,
@@ -283,6 +305,7 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
sourceColumns: sourceColumns.value,
rows: rows.map((item) => item.data),
excludePrimaryKeys,
+ insertMode,
})
: await buildDataGridCopyInsertStatement({
databaseType: databaseType.value,
@@ -291,19 +314,20 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
sourceColumns: sourceColumns.value,
rows: rows.map((item) => item.data),
excludePrimaryKeys,
+ insertMode,
});
- const latest = insertCopyCache(excludePrimaryKeys);
+ const latest = insertCopyCache(excludePrimaryKeys, insertMode);
if (latest.key !== key) return;
- setInsertCopyCache(excludePrimaryKeys, {
+ setInsertCopyCache(excludePrimaryKeys, insertMode, {
key,
text: statement ?? "",
loading: false,
ready: !!statement,
});
} catch {
- const latest = insertCopyCache(excludePrimaryKeys);
+ const latest = insertCopyCache(excludePrimaryKeys, insertMode);
if (latest.key !== key) return;
- setInsertCopyCache(excludePrimaryKeys, {
+ setInsertCopyCache(excludePrimaryKeys, insertMode, {
key,
text: "",
loading: false,
@@ -312,14 +336,14 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
}
}
- function canCopyPreparedInsert(excludePrimaryKeys: boolean): boolean {
- const cache = insertCopyCache(excludePrimaryKeys);
- return cache.ready && cache.key === insertCopyKey(excludePrimaryKeys);
+ function canCopyPreparedInsert(excludePrimaryKeys: boolean, insertMode: DataGridCopyInsertMode = "merged"): boolean {
+ const cache = insertCopyCache(excludePrimaryKeys, insertMode);
+ return cache.ready && cache.key === insertCopyKey(excludePrimaryKeys, insertMode);
}
- function copyPreparedRowAsInsert(excludePrimaryKeys: boolean): boolean {
- if (!canCopyPreparedInsert(excludePrimaryKeys)) return false;
- void copyText(insertCopyCache(excludePrimaryKeys).text);
+ function copyPreparedRowAsInsert(excludePrimaryKeys: boolean, insertMode: DataGridCopyInsertMode = "merged"): boolean {
+ if (!canCopyPreparedInsert(excludePrimaryKeys, insertMode)) return false;
+ void copyText(insertCopyCache(excludePrimaryKeys, insertMode).text);
return true;
}
@@ -478,12 +502,12 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
return targetedRows().filter((item) => !item.isDraft);
}
- async function copyRowAsInsert() {
- copyPreparedRowAsInsert(false);
+ async function copyRowAsInsert(insertMode: DataGridCopyInsertMode = "merged") {
+ copyPreparedRowAsInsert(false, insertMode);
}
- async function copyRowAsInsertWithoutPrimaryKeys() {
- copyPreparedRowAsInsert(true);
+ async function copyRowAsInsertWithoutPrimaryKeys(insertMode: DataGridCopyInsertMode = "merged") {
+ copyPreparedRowAsInsert(true, insertMode);
}
async function copyRowAsUpdate() {
@@ -1147,7 +1171,7 @@ function replaceControlCharacters(value: string, replacement: string): string {
.join("");
}
-function buildMongoCopyInsertStatement(options: { collection: string; columns: string[]; sourceColumns?: Array; rows: CellValue[][]; excludePrimaryKeys?: boolean }): string | undefined {
+function buildMongoCopyInsertStatement(options: { collection: string; columns: string[]; sourceColumns?: Array; rows: CellValue[][]; excludePrimaryKeys?: boolean; insertMode?: DataGridCopyInsertMode }): string | undefined {
const saveColumns = effectiveColumns(options.sourceColumns, options.columns);
const columnIndexes = saveColumns.map((column, index) => ({ column, index })).filter((item): item is { column: string; index: number } => !!item.column);
if (columnIndexes.length === 0 || options.rows.length === 0) return undefined;
@@ -1155,6 +1179,9 @@ function buildMongoCopyInsertStatement(options: { collection: string; columns: s
const documents = options.rows.map((row) => buildMongoCopyInsertDocument(columnIndexes.map((item) => row[item.index]) as MongoInputValue[], documentColumns, { excludePrimaryKeys: options.excludePrimaryKeys }));
const collection = `db.getCollection(${JSON.stringify(options.collection)})`;
if (documents.length === 1) return `${collection}.insert(${formatMongoShellLiteral(documents[0])});`;
+ if (options.insertMode === "row-by-row") {
+ return documents.map((document) => `${collection}.insert(${formatMongoShellLiteral(document)});`).join("\n");
+ }
return `${collection}.insertMany(${formatMongoShellLiteral(documents)});`;
}
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 3d6fcef6f6..48e0a81cf4 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -832,7 +832,11 @@ export default {
copyRows: "Copy {count} Rows (JSON)",
copyColumnsJson: "Copy {count} Columns (JSON)",
copyRowsInsert: "Copy {count} Rows as INSERT",
+ copyRowsInsertMerged: "Copy {count} Rows as INSERT (Merged)",
+ copyRowsInsertRowByRow: "Copy {count} Rows as INSERT (Row by Row)",
copyRowsInsertWithoutPrimaryKeys: "Copy {count} Rows as INSERT without Primary Keys",
+ copyRowsInsertWithoutPrimaryKeysMerged: "Copy {count} Rows as INSERT without Primary Keys (Merged)",
+ copyRowsInsertWithoutPrimaryKeysRowByRow: "Copy {count} Rows as INSERT without Primary Keys (Row by Row)",
copyRowsUpdate: "Copy {count} Rows as UPDATE",
selectedRows: "{count} rows selected",
restoreRow: "Restore Row",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index cf1bfca546..2ca735be41 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -786,7 +786,11 @@ export default withEnglishFallback({
copyRows: "Copiar {count} filas (JSON)",
copyColumnsJson: "Copiar {count} columnas (JSON)",
copyRowsInsert: "Copiar {count} filas como INSERT",
+ copyRowsInsertMerged: "Copiar {count} filas como INSERT (combinado)",
+ copyRowsInsertRowByRow: "Copiar {count} filas como INSERT (fila por fila)",
copyRowsInsertWithoutPrimaryKeys: "Copiar {count} filas como INSERT sin claves primarias",
+ copyRowsInsertWithoutPrimaryKeysMerged: "Copiar {count} filas como INSERT sin claves primarias (combinado)",
+ copyRowsInsertWithoutPrimaryKeysRowByRow: "Copiar {count} filas como INSERT sin claves primarias (fila por fila)",
copyRowsUpdate: "Copiar {count} filas como UPDATE",
selectedRows: "{count} filas seleccionadas",
restoreRow: "Restaurar fila",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 71783b9250..147d2fa429 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -784,7 +784,11 @@ export default withEnglishFallback({
copyRows: "Copia {count} Righe (JSON)",
copyColumnsJson: "Copia {count} Colonne (JSON)",
copyRowsInsert: "Copia {count} Righe come INSERT",
+ copyRowsInsertMerged: "Copia {count} Righe come INSERT (unito)",
+ copyRowsInsertRowByRow: "Copia {count} Righe come INSERT (riga per riga)",
copyRowsInsertWithoutPrimaryKeys: "Copia {count} Righe come INSERT senza Chiavi Primarie",
+ copyRowsInsertWithoutPrimaryKeysMerged: "Copia {count} Righe come INSERT senza Chiavi Primarie (unito)",
+ copyRowsInsertWithoutPrimaryKeysRowByRow: "Copia {count} Righe come INSERT senza Chiavi Primarie (riga per riga)",
copyRowsUpdate: "Copia {count} Righe come UPDATE",
selectedRows: "{count} righe selezionate",
restoreRow: "Ripristina Riga",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 8b47efc19e..da06c3b8da 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -780,7 +780,11 @@ export default withEnglishFallback({
copyRows: "{count}行をコピー (JSON)",
copyColumnsJson: "{count}列をコピー (JSON)",
copyRowsInsert: "{count}行をINSERTとしてコピー",
+ copyRowsInsertMerged: "{count}行をINSERTとしてコピー(まとめて)",
+ copyRowsInsertRowByRow: "{count}行をINSERTとしてコピー(行ごと)",
copyRowsInsertWithoutPrimaryKeys: "{count}行を主キーなしでINSERTとしてコピー",
+ copyRowsInsertWithoutPrimaryKeysMerged: "{count}行を主キーなしでINSERTとしてコピー(まとめて)",
+ copyRowsInsertWithoutPrimaryKeysRowByRow: "{count}行を主キーなしでINSERTとしてコピー(行ごと)",
copyRowsUpdate: "{count}行をUPDATEとしてコピー",
selectedRows: "{count}行選択中",
restoreRow: "行を復元",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 6064582dd0..8fa0a2567b 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -785,7 +785,11 @@ export default withEnglishFallback({
copyRows: "Copiar {count} Linhas (JSON)",
copyColumnsJson: "Copiar {count} Colunas (JSON)",
copyRowsInsert: "Copiar {count} Linhas como INSERT",
+ copyRowsInsertMerged: "Copiar {count} Linhas como INSERT (mesclado)",
+ copyRowsInsertRowByRow: "Copiar {count} Linhas como INSERT (linha por linha)",
copyRowsInsertWithoutPrimaryKeys: "Copiar {count} Linhas como INSERT sem Chaves Primárias",
+ copyRowsInsertWithoutPrimaryKeysMerged: "Copiar {count} Linhas como INSERT sem Chaves Primárias (mesclado)",
+ copyRowsInsertWithoutPrimaryKeysRowByRow: "Copiar {count} Linhas como INSERT sem Chaves Primárias (linha por linha)",
copyRowsUpdate: "Copiar {count} Linhas como UPDATE",
selectedRows: "{count} linhas selecionadas",
restoreRow: "Restaurar Linha",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 1a969cc4dd..ba10f73555 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -834,7 +834,11 @@ export default withEnglishFallback({
copyRows: "复制 {count} 行 (JSON)",
copyColumnsJson: "复制 {count} 列 (JSON)",
copyRowsInsert: "复制 {count} 行为 INSERT",
+ copyRowsInsertMerged: "复制 {count} 行为 INSERT(合并)",
+ copyRowsInsertRowByRow: "复制 {count} 行为 INSERT(逐行)",
copyRowsInsertWithoutPrimaryKeys: "复制 {count} 行为 INSERT(不含主键)",
+ copyRowsInsertWithoutPrimaryKeysMerged: "复制 {count} 行为 INSERT(不含主键,合并)",
+ copyRowsInsertWithoutPrimaryKeysRowByRow: "复制 {count} 行为 INSERT(不含主键,逐行)",
copyRowsUpdate: "复制 {count} 行为 UPDATE",
selectedRows: "已选 {count} 行",
restoreRow: "恢复行",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index a5de672708..0b525344be 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -785,7 +785,11 @@ export default withEnglishFallback({
copyRows: "複製 {count} 筆 (JSON)",
copyColumnsJson: "複製 {count} 欄 (JSON)",
copyRowsInsert: "複製 {count} 筆為 INSERT",
+ copyRowsInsertMerged: "複製 {count} 筆為 INSERT(合併)",
+ copyRowsInsertRowByRow: "複製 {count} 筆為 INSERT(逐筆)",
copyRowsInsertWithoutPrimaryKeys: "複製 {count} 筆為 INSERT(不含主鍵)",
+ copyRowsInsertWithoutPrimaryKeysMerged: "複製 {count} 筆為 INSERT(不含主鍵,合併)",
+ copyRowsInsertWithoutPrimaryKeysRowByRow: "複製 {count} 筆為 INSERT(不含主鍵,逐筆)",
copyRowsUpdate: "複製 {count} 筆為 UPDATE",
selectedRows: "已選 {count} 筆",
restoreRow: "復原資料",
diff --git a/apps/desktop/src/lib/dataGrid/dataGridSql.ts b/apps/desktop/src/lib/dataGrid/dataGridSql.ts
index e24f583a56..62a41145ef 100644
--- a/apps/desktop/src/lib/dataGrid/dataGridSql.ts
+++ b/apps/desktop/src/lib/dataGrid/dataGridSql.ts
@@ -38,6 +38,8 @@ export interface DataGridCopyUpdateStatementOptions {
rows: GridCellValue[][];
}
+export type DataGridCopyInsertMode = "merged" | "row-by-row";
+
export interface DataGridCopyInsertStatementOptions {
databaseType?: DatabaseType;
tableMeta?: DataGridTableMeta;
@@ -45,6 +47,7 @@ export interface DataGridCopyInsertStatementOptions {
sourceColumns?: Array;
rows: GridCellValue[][];
excludePrimaryKeys?: boolean;
+ insertMode?: DataGridCopyInsertMode;
}
export type DataGridContextFilterMode = "equals" | "not-equals" | "is-null" | "is-not-null" | "like" | "not-like" | "less-than" | "greater-than";
diff --git a/crates/dbx-core/src/data_grid_sql.rs b/crates/dbx-core/src/data_grid_sql.rs
index 0423825bd1..4373d8e452 100644
--- a/crates/dbx-core/src/data_grid_sql.rs
+++ b/crates/dbx-core/src/data_grid_sql.rs
@@ -96,6 +96,16 @@ pub struct DataGridCopyInsertStatementOptions {
pub rows: Vec>,
#[serde(default)]
pub exclude_primary_keys: bool,
+ #[serde(default)]
+ pub insert_mode: DataGridCopyInsertMode,
+}
+
+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum DataGridCopyInsertMode {
+ #[default]
+ Merged,
+ RowByRow,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
@@ -359,7 +369,9 @@ pub fn build_data_grid_copy_insert_statement(options: DataGridCopyInsertStatemen
)
})
.collect::>();
- if options.database_type.is_some_and(uses_single_row_insert_statements) {
+ if options.insert_mode == DataGridCopyInsertMode::RowByRow
+ || options.database_type.is_some_and(uses_single_row_insert_statements)
+ {
return Some(
value_rows
.iter()
@@ -2067,6 +2079,7 @@ mod tests {
source_columns: None,
rows: vec![vec![json!(1), json!("ada"), json!("Ada")], vec![json!(2), json!("linus"), json!("Linus")]],
exclude_primary_keys: true,
+ insert_mode: DataGridCopyInsertMode::Merged,
});
assert_eq!(
statement.as_deref(),
@@ -2074,6 +2087,30 @@ mod tests {
);
}
+ #[test]
+ fn builds_copy_insert_statement_row_by_row() {
+ let statement = build_data_grid_copy_insert_statement(DataGridCopyInsertStatementOptions {
+ database_type: Some(DatabaseType::Mysql),
+ table_meta: Some(DataGridTableMeta {
+ schema: None,
+ table_name: "users".to_string(),
+ primary_keys: vec!["id".to_string()],
+ columns: None,
+ }),
+ columns: vec!["id".to_string(), "login_name".to_string(), "display_name".to_string()],
+ source_columns: None,
+ rows: vec![vec![json!(1), json!("ada"), json!("Ada")], vec![json!(2), json!("linus"), json!("Linus")]],
+ exclude_primary_keys: false,
+ insert_mode: DataGridCopyInsertMode::RowByRow,
+ });
+ assert_eq!(
+ statement.as_deref(),
+ Some(
+ "INSERT INTO `users` (`id`, `login_name`, `display_name`) VALUES (1, 'ada', 'Ada');\nINSERT INTO `users` (`id`, `login_name`, `display_name`) VALUES (2, 'linus', 'Linus');"
+ )
+ );
+ }
+
#[test]
fn oracle_copy_insert_statement_uses_one_statement_per_row() {
let statement = build_data_grid_copy_insert_statement(DataGridCopyInsertStatementOptions {
@@ -2088,6 +2125,7 @@ mod tests {
source_columns: None,
rows: vec![vec![json!(1), json!("Ada")], vec![json!(2), json!("Linus")]],
exclude_primary_keys: false,
+ insert_mode: DataGridCopyInsertMode::Merged,
});
assert_eq!(
@@ -2114,6 +2152,7 @@ mod tests {
source_columns: None,
rows: rows.clone(),
exclude_primary_keys: false,
+ insert_mode: DataGridCopyInsertMode::Merged,
});
assert_eq!(
insert.as_deref(),
@@ -2174,6 +2213,7 @@ mod tests {
source_columns: None,
rows: vec![vec![json!(1), json!("Hello"), json!("'hello':1A")]],
exclude_primary_keys: false,
+ insert_mode: DataGridCopyInsertMode::Merged,
});
assert_eq!(
diff --git a/crates/dbx-core/tests/live_postgres_tsvector.rs b/crates/dbx-core/tests/live_postgres_tsvector.rs
index 0b1a566a72..a5e75a5995 100644
--- a/crates/dbx-core/tests/live_postgres_tsvector.rs
+++ b/crates/dbx-core/tests/live_postgres_tsvector.rs
@@ -1,7 +1,8 @@
use std::time::Duration;
use dbx_core::data_grid_sql::{
- build_data_grid_copy_insert_statement, DataGridColumnInfo, DataGridCopyInsertStatementOptions, DataGridTableMeta,
+ build_data_grid_copy_insert_statement, DataGridColumnInfo, DataGridCopyInsertMode,
+ DataGridCopyInsertStatementOptions, DataGridTableMeta,
};
use dbx_core::database_export::{build_export_insert_statements, BuildExportInsertStatementsOptions};
use dbx_core::db::postgres;
@@ -72,6 +73,7 @@ async fn postgres_tsvector_generated_columns_are_readable_and_omitted_from_inser
source_columns: None,
rows: result.rows.clone(),
exclude_primary_keys: false,
+ insert_mode: DataGridCopyInsertMode::Merged,
})
.expect("copy insert");
assert!(copy_insert.contains("\"id\", \"title\", \"body\""));