diff --git a/packages/server/src/api/controllers/table/internal.ts b/packages/server/src/api/controllers/table/internal.ts index 6d1c67e800..1562054ab4 100644 --- a/packages/server/src/api/controllers/table/internal.ts +++ b/packages/server/src/api/controllers/table/internal.ts @@ -70,22 +70,10 @@ export async function bulkImport( ) { const table = await sdk.tables.getTable(ctx.params.tableId) const { rows, identifierFields } = ctx.request.body - await handleDataImport( - { - ...table, - schema: { - _id: { - name: "_id", - type: FieldType.STRING, - }, - ...table.schema, - }, - }, - { - importRows: rows, - identifierFields, - user: ctx.user, - } - ) + await handleDataImport(table, { + importRows: rows, + identifierFields, + user: ctx.user, + }) return table } diff --git a/packages/server/src/utilities/schema.ts b/packages/server/src/utilities/schema.ts index b1fbd7577a..cfdd0d753a 100644 --- a/packages/server/src/utilities/schema.ts +++ b/packages/server/src/utilities/schema.ts @@ -148,9 +148,16 @@ export function parse(rows: Rows, table: Table): Rows { Object.keys(row).forEach(columnName => { const columnData = row[columnName] + + if (columnName === "_id") { + parsedRow[columnName] = columnData + return + } + const schema = table.schema if (!(columnName in schema)) { - // Objects can be present in the row data but not in the schema, so make sure we don't proceed in such a case + // Objects can be present in the row data but not in the schema, so make + // sure we don't proceed in such a case return }