Browse Source

feat: add composite support in baseModel ee version - bulkinsert with nested data

pull/7649/head
Pranav C 7 months ago
parent
commit
7898d68790
  1. 10
      packages/nocodb/src/db/BaseModelSqlv2.ts

10
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -2924,7 +2924,7 @@ class BaseModelSqlv2 {
return rowId; return rowId;
} }
private async prepareNestedLinkQb({ protected async prepareNestedLinkQb({
nestedCols, nestedCols,
data, data,
insertObj, insertObj,
@ -3243,17 +3243,17 @@ class BaseModelSqlv2 {
); );
} }
} else { } else {
const returningObj: Record<string, string> = {}; const returningArr: string[] = [];
for (const col of this.model.primaryKeys) { for (const col of this.model.primaryKeys) {
returningObj[col.title] = col.column_name; returningArr.push(col.column_name);
} }
responses = responses =
!raw && (this.isPg || this.isMssql) !raw && (this.isPg || this.isMssql)
? await trx ? await trx
.batchInsert(this.tnPath, insertDatas, chunkSize) .batchInsert(this.tnPath, insertDatas, chunkSize)
.returning(returningObj) .returning(this.model.primaryKeys?.length ? returningArr : '*')
: await trx.batchInsert(this.tnPath, insertDatas, chunkSize); : await trx.batchInsert(this.tnPath, insertDatas, chunkSize);
} }
@ -4025,7 +4025,7 @@ class BaseModelSqlv2 {
} }
// method for validating otpions if column is single/multi select // method for validating otpions if column is single/multi select
private async validateOptions( protected async validateOptions(
column: Column<any>, column: Column<any>,
insertOrUpdateObject: Record<string, any>, insertOrUpdateObject: Record<string, any>,
) { ) {

Loading…
Cancel
Save