Browse Source

feat: upgrade migrations

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

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

@ -1169,11 +1169,11 @@ export default abstract class BaseApiBuilder<T extends Noco> implements XcDynami
} }
protected async getManyToManyRelations({parent = null, child = null} = {}) { protected async getManyToManyRelations({parent = null, child = null, localMetas = null} = {}) {
const metas = new Set<any>(); const metas = new Set<any>();
const assocMetas = new Set<any>(); const assocMetas = new Set<any>();
for (const meta of Object.values(this.metas)) { for (const meta of localMetas || Object.values(this.metas)) {
// check if table is a Bridge table(or Associative Table) by checking // check if table is a Bridge table(or Associative Table) by checking
// number of foreign keys and columns // number of foreign keys and columns
@ -1272,10 +1272,12 @@ export default abstract class BaseApiBuilder<T extends Noco> implements XcDynami
await this.xcMeta.metaUpdate(this.projectId, this.dbAlias, 'nc_models', { await this.xcMeta.metaUpdate(this.projectId, this.dbAlias, 'nc_models', {
mm: 1, mm: 1,
}, {title: meta.tn}) }, {title: meta.tn})
if (!localMetas) {
XcCache.del([this.projectId, this.dbAlias, 'table', meta.tn].join('::')); XcCache.del([this.projectId, this.dbAlias, 'table', meta.tn].join('::'));
this.models[meta.tn] = this.getBaseModel(meta) this.models[meta.tn] = this.getBaseModel(meta)
} }
} }
}
private getColumnNameAlias(col, tableName?: string) { private getColumnNameAlias(col, tableName?: string) {
@ -1686,7 +1688,7 @@ export default abstract class BaseApiBuilder<T extends Noco> implements XcDynami
} }
// generate many to many relations an columns // generate many to many relations an columns
await this.getManyToManyRelations(); await this.getManyToManyRelations({localMetas: metas});
return metas; return metas;
} }
} }

Loading…
Cancel
Save