Browse Source

Merge branch 'develop' into feat/backend-refactoring-nest

pull/5444/head
Wing-Kam Wong 2 years ago
parent
commit
2b14159453
  1. 12
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts
  2. 4
      packages/nocodb/src/lib/plugins/vultr/index.ts
  3. 63
      tests/playwright/tests/megaTable.spec.ts

12
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) {

4
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',

63
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}`);
}
});
});

Loading…
Cancel
Save