Browse Source

fix: save foreign key constraint of existing relations

re #496

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/498/head
Pranav C 3 years ago
parent
commit
43b859f695
  1. 5
      packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts

5
packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts

@ -1316,7 +1316,8 @@ export default abstract class BaseApiBuilder<T extends Noco> implements XcDynami
'_rtn',
'type',
'db_type',
'dr'
'dr',
'fkn'
]
});
@ -1337,6 +1338,7 @@ export default abstract class BaseApiBuilder<T extends Noco> implements XcDynami
// todo: insert parallelly
for (const relation of relations) {
relation.enabled = true;
relation.fkn= relation?.cstn ;
await this.xcMeta.metaInsert(this.projectId, this.dbAlias, 'nc_relations', {
tn: relation.tn,
_tn: this.getTableNameAlias(relation.tn),
@ -1350,6 +1352,7 @@ export default abstract class BaseApiBuilder<T extends Noco> implements XcDynami
db_type: this.connectionConfig?.client,
dr: relation?.dr,
ur: relation?.ur,
fkn: relation?.cstn
})
}
return relations;

Loading…
Cancel
Save