Browse Source

fix: link/unlink - mm

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5901/head
Pranav C 1 year ago
parent
commit
5b04a70d5b
  1. 6
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -3542,7 +3542,7 @@ class BaseModelSqlv2 {
qb.on( qb.on(
`${vTable.table_name}.${vParentCol.column_name}`, `${vTable.table_name}.${vParentCol.column_name}`,
`${parentTable.table_name}.${parentColumn.column_name}`, `${parentTable.table_name}.${parentColumn.column_name}`,
).orOn( ).andOn(
`${vTable.table_name}.${vChildCol.column_name}`, `${vTable.table_name}.${vChildCol.column_name}`,
row[childColumn.column_name], row[childColumn.column_name],
); );
@ -3583,6 +3583,9 @@ class BaseModelSqlv2 {
[vParentCol.column_name]: childRow[parentColumn.column_name], [vParentCol.column_name]: childRow[parentColumn.column_name],
[vChildCol.column_name]: row[childColumn.column_name], [vChildCol.column_name]: row[childColumn.column_name],
})); }));
// if no new links, return true
if(!insertData.length) return true
} }
// if (this.isSnowflake) { // if (this.isSnowflake) {
@ -3785,7 +3788,6 @@ class BaseModelSqlv2 {
this.dbDriver(parentTn) this.dbDriver(parentTn)
.select(parentColumn.column_name) .select(parentColumn.column_name)
.whereIn(parentTable.primaryKey.column_name, childIds) .whereIn(parentTable.primaryKey.column_name, childIds)
.first(),
) )
.delete(); .delete();
} }

Loading…
Cancel
Save