Browse Source

fix(gui): Sqlite relation create

fix #322

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
pull/341/head
Pranav C 3 years ago
parent
commit
ddaa663f66
  1. 1
      packages/nocodb/src/lib/noco/NcProjectBuilder.ts
  2. 10
      packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts

1
packages/nocodb/src/lib/noco/NcProjectBuilder.ts

@ -119,6 +119,7 @@ export default class NcProjectBuilder {
case 'xcVirtualRelationCreate':
await curBuilder.onVirtualRelationCreate(data.req.args.parentTable, data.req.args.childTable);
await curBuilder.onRelationCreate(data.req.args.parentTable, data.req.args.childTable, {
...data.req.args,
virtual: true

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

@ -726,6 +726,16 @@ export default abstract class BaseApiBuilder<T extends Noco> implements XcDynami
});
}
public async onVirtualRelationCreate(parentTable: string, childTable: string): Promise<any> {
return this.xcMeta.metaUpdate(this.projectId, this.dbAlias, 'nc_relations', {
_tn: this.getTableNameAlias(childTable),
_rtn: this.getTableNameAlias(parentTable),
}, {
tn: childTable,
rtn: parentTable,
});
}
protected async loadCommon(): Promise<any> {
this.baseLog(`loadCommon :`);

Loading…
Cancel
Save