From 7239688f90140eebd7267062fecaa81b0113132f Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 17 Apr 2023 12:11:38 +0800 Subject: [PATCH 1/3] chore(nocodb): lint --- packages/nocodb/src/lib/plugins/vultr/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/plugins/vultr/index.ts b/packages/nocodb/src/lib/plugins/vultr/index.ts index 2bf072c226..773841132b 100644 --- a/packages/nocodb/src/lib/plugins/vultr/index.ts +++ b/packages/nocodb/src/lib/plugins/vultr/index.ts @@ -20,12 +20,12 @@ const config: XcPluginConfig = { type: XcType.SingleLineText, required: true, }, - { + { key: 'hostname', label: 'Host Name', placeholder: 'e.g.: ewr1.vultrobjects.com', type: XcType.SingleLineText, - required: true + required: true, }, { key: 'access_key', From 34a0dedfcb698e12b5748e4750959fae84c7786a Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:06:24 +0530 Subject: [PATCH 2/3] test: 1k links test Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- tests/playwright/tests/megaTable.spec.ts | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/playwright/tests/megaTable.spec.ts b/tests/playwright/tests/megaTable.spec.ts index 578e121103..ffa3976579 100644 --- a/tests/playwright/tests/megaTable.spec.ts +++ b/tests/playwright/tests/megaTable.spec.ts @@ -157,4 +157,67 @@ test.describe.serial('Test table', () => { await page.reload(); }); + + test.skip('mega table - LinkToAnotherRecord', async ({ page }) => { + let table_1, table_2; + const columns = []; + + // a Primary key column & display column + columns.push( + { + column_name: 'Id', + title: 'Id', + uidt: UITypes.ID, + }, + { + column_name: 'SingleLineText', + title: 'SingleLineText', + uidt: UITypes.SingleLineText, + pv: true, + } + ); + + const project = await api.project.read(context.project.id); + // eslint-disable-next-line prefer-const + table_1 = await api.base.tableCreate(context.project.id, project.bases?.[0].id, { + table_name: 'table_1', + title: 'table_1', + columns: columns, + }); + // eslint-disable-next-line prefer-const + table_2 = await api.base.tableCreate(context.project.id, project.bases?.[0].id, { + table_name: 'table_2', + title: 'table_2', + columns: columns, + }); + + const rows = []; + for (let i = 0; i < 1000; i++) { + rows.push({ + Id: i + 1, + SingleLineText: `SingleLineText${i + 1}`, + }); + } + await api.dbTableRow.bulkCreate('noco', context.project.id, table_1.id, rows); + await api.dbTableRow.bulkCreate('noco', context.project.id, table_2.id, rows); + + await api.dbTableColumn.create(table_2.id, { + uidt: UITypes.LinkToAnotherRecord, + title: 'LinkToAnotherRecord', + column_name: 'LinkToAnotherRecord', + parentId: table_1.id, + childId: table_2.id, + type: 'hm', + }); + + // // nested add : hm + // for (let i = 1; i <= 1000; i++) { + // await api.dbTableRow.nestedAdd('noco', project.title, table_1.table_name, i, 'hm', 'LinkToAnotherRecord', `${i}`); + // } + + // nested add : bt + for (let i = 1; i <= 1000; i++) { + await api.dbTableRow.nestedAdd('noco', project.title, table_2.table_name, i, 'bt', 'table_1', `${i}`); + } + }); }); From 225e99245d08f5ec558c438ee635f95acbfe69ab Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 17 Apr 2023 12:42:47 +0800 Subject: [PATCH 3/3] fix(nocodb): bulk update transaction --- .../lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index 453af0f141..426445c431 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -2117,12 +2117,10 @@ class BaseModelSqlv2 { datas.map((d) => this.model.mapAliasToColumn(d)) ); - transaction = await this.dbDriver.transaction(); - - // await this.beforeUpdateb(updateDatas, transaction); const prevData = []; const newData = []; const updatePkValues = []; + const toBeUpdated = []; const res = []; for (const d of updateDatas) { await this.validate(d); @@ -2133,11 +2131,17 @@ class BaseModelSqlv2 { } prevData.push(await this.readByPk(pkValues)); const wherePk = await this._wherePk(pkValues); - await transaction(this.tnPath).update(d).where(wherePk); res.push(wherePk); + toBeUpdated.push({ d, wherePk }); updatePkValues.push(pkValues); } + transaction = await this.dbDriver.transaction(); + + for (const o of toBeUpdated) { + await transaction(this.tnPath).update(o.d).where(o.wherePk); + } + await transaction.commit(); for (const pkValues of updatePkValues) {