Browse Source

fix(nocodb): backend crash issue

pull/8901/head
Ramesh Mane 5 months ago
parent
commit
5fd8d789cd
  1. 60
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -5554,11 +5554,15 @@ class BaseModelSqlv2 {
const [parentRelatedPkValue, childRelatedPkValue] = const [parentRelatedPkValue, childRelatedPkValue] =
await Promise.all([ await Promise.all([
await this.dbDriver(childTn) await this.dbDriver(childTn)
.select(childTable.displayValue.title) .select(
`${childTable.table_name}.${childTable.displayValue.column_name}`,
)
.where(_wherePk(childTable.primaryKeys, childId)) .where(_wherePk(childTable.primaryKeys, childId))
.first(), .first(),
await this.dbDriver(parentTn) await this.dbDriver(parentTn)
.select(parentTable.displayValue.title) .select(
`${parentTable.table_name}.${parentTable.displayValue.column_name}`,
)
.where(_wherePk(parentTable.primaryKeys, oldRowId)) .where(_wherePk(parentTable.primaryKeys, oldRowId))
.first(), .first(),
]); ]);
@ -5638,7 +5642,9 @@ class BaseModelSqlv2 {
}); });
const childRelatedPkValue = await this.dbDriver(childTn) const childRelatedPkValue = await this.dbDriver(childTn)
.select(childTable.displayValue.title) .select(
`${childTable.table_name}.${childTable.displayValue.column_name}`,
)
.where(_wherePk(childTable.primaryKeys, rowId)) .where(_wherePk(childTable.primaryKeys, rowId))
.first(); .first();
@ -5668,11 +5674,15 @@ class BaseModelSqlv2 {
const [parentRelatedPkValue, childRelatedPkValue] = const [parentRelatedPkValue, childRelatedPkValue] =
await Promise.all([ await Promise.all([
await this.dbDriver(parentTn) await this.dbDriver(parentTn)
.select(parentTable.displayValue.title) .select(
`${parentTable.table_name}.${parentTable.displayValue.column_name}`,
)
.where(_wherePk(parentTable.primaryKeys, oldChildRowId)) .where(_wherePk(parentTable.primaryKeys, oldChildRowId))
.first(), .first(),
await this.dbDriver(childTn) await this.dbDriver(childTn)
.select(childTable.displayValue.title) .select(
`${childTable.table_name}.${childTable.displayValue.column_name}`,
)
.where(_wherePk(childTable.primaryKeys, rowId)) .where(_wherePk(childTable.primaryKeys, rowId))
.first(), .first(),
]); ]);
@ -5747,11 +5757,15 @@ class BaseModelSqlv2 {
const [parentRelatedPkValue, childRelatedPkValue] = const [parentRelatedPkValue, childRelatedPkValue] =
await Promise.all([ await Promise.all([
await this.dbDriver(childTn) await this.dbDriver(childTn)
.select(childTable.displayValue.title) .select(
`${childTable.table_name}.${childTable.displayValue.column_name}`,
)
.where(_wherePk(childTable.primaryKeys, rowId)) .where(_wherePk(childTable.primaryKeys, rowId))
.first(), .first(),
await this.dbDriver(parentTn) await this.dbDriver(parentTn)
.select(parentTable.displayValue.title) .select(
`${parentTable.table_name}.${parentTable.displayValue.column_name}`,
)
.where(_wherePk(parentTable.primaryKeys, oldChildRowId)) .where(_wherePk(parentTable.primaryKeys, oldChildRowId))
.first(), .first(),
]); ]);
@ -5804,11 +5818,15 @@ class BaseModelSqlv2 {
const [parentRelatedPkValue, childRelatedPkValue] = const [parentRelatedPkValue, childRelatedPkValue] =
await Promise.all([ await Promise.all([
await this.dbDriver(parentTn) await this.dbDriver(parentTn)
.select(parentTable.displayValue.title) .select(
`${parentTable.table_name}.${parentTable.displayValue.column_name}`,
)
.where(_wherePk(parentTable.primaryKeys, childId)) .where(_wherePk(parentTable.primaryKeys, childId))
.first(), .first(),
await this.dbDriver(childTn) await this.dbDriver(childTn)
.select(childTable.displayValue.title) .select(
`${childTable.table_name}.${childTable.displayValue.column_name}`,
)
.where(_wherePk(childTable.primaryKeys, oldRowId)) .where(_wherePk(childTable.primaryKeys, oldRowId))
.first(), .first(),
]); ]);
@ -5860,11 +5878,15 @@ class BaseModelSqlv2 {
const [parentRelatedPkValue, childRelatedPkValue] = const [parentRelatedPkValue, childRelatedPkValue] =
await Promise.all([ await Promise.all([
await this.dbDriver(childTn) await this.dbDriver(childTn)
.select(childTable.displayValue.title) .select(
`${childTable.table_name}.${childTable.displayValue.column_name}`,
)
.where(_wherePk(childTable.primaryKeys, oldChildRowId)) .where(_wherePk(childTable.primaryKeys, oldChildRowId))
.first(), .first(),
await this.dbDriver(parentTn) await this.dbDriver(parentTn)
.select(parentTable.displayValue.title) .select(
`${parentTable.table_name}.${parentTable.displayValue.column_name}`,
)
.where(_wherePk(parentTable.primaryKeys, rowId)) .where(_wherePk(parentTable.primaryKeys, rowId))
.first(), .first(),
]); ]);
@ -5905,11 +5927,15 @@ class BaseModelSqlv2 {
const [parentRelatedPkValue, childRelatedPkValue] = const [parentRelatedPkValue, childRelatedPkValue] =
await Promise.all([ await Promise.all([
await this.dbDriver(childTn) await this.dbDriver(childTn)
.select(childTable.displayValue.title) .select(
`${childTable.table_name}.${childTable.displayValue.column_name}`,
)
.where(_wherePk(childTable.primaryKeys, childId)) .where(_wherePk(childTable.primaryKeys, childId))
.first(), .first(),
await this.dbDriver(parentTn) await this.dbDriver(parentTn)
.select(parentTable.displayValue.title) .select(
`${parentTable.table_name}.${parentTable.displayValue.column_name}`,
)
.where(_wherePk(parentTable.primaryKeys, oldRowId)) .where(_wherePk(parentTable.primaryKeys, oldRowId))
.first(), .first(),
]); ]);
@ -6049,7 +6075,9 @@ class BaseModelSqlv2 {
): Promise<void> { ): Promise<void> {
if (!pkValue) { if (!pkValue) {
pkValue = await this.dbDriver(this.getTnPath(childModel)) pkValue = await this.dbDriver(this.getTnPath(childModel))
.select(childModel.displayValue.title) .select(
`${childModel.table_name}.${childModel.displayValue.column_name}`,
)
.where(_wherePk(childModel.primaryKeys, childId)) .where(_wherePk(childModel.primaryKeys, childId))
.first(); .first();
} }
@ -6290,7 +6318,9 @@ class BaseModelSqlv2 {
): Promise<void> { ): Promise<void> {
if (!pkValue) { if (!pkValue) {
pkValue = await this.dbDriver(this.getTnPath(childModel)) pkValue = await this.dbDriver(this.getTnPath(childModel))
.select(childModel.displayValue.title) .select(
`${childModel.table_name}.${childModel.displayValue.column_name}`,
)
.where(_wherePk(childModel.primaryKeys, childId)) .where(_wherePk(childModel.primaryKeys, childId))
.first(); .first();
} }

Loading…
Cancel
Save