mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-01 11:47:51 +08:00
fix: model is not null
This commit is contained in:
parent
aef6b85736
commit
59db7a34dc
@ -239,7 +239,10 @@ export default class Database {
|
||||
}
|
||||
for (const name of names) {
|
||||
// @ts-ignore
|
||||
sequelize.modelManager.addModel(this.getModel(name));
|
||||
const model = this.getModel(name);
|
||||
if (model) {
|
||||
sequelize.modelManager.addModel(model);
|
||||
}
|
||||
}
|
||||
await sequelize.sync(restOptions);
|
||||
await sequelize.close();
|
||||
|
@ -238,12 +238,13 @@ export class Table {
|
||||
*/
|
||||
public getRelatedTableNames(): Set<string> {
|
||||
const names = new Set<string>();
|
||||
names.add(this.options.name);
|
||||
this.options.name && names.add(this.options.name);
|
||||
for (const association of this.associations.values()) {
|
||||
const target = association.getTarget();
|
||||
names.add(target);
|
||||
target && names.add(target);
|
||||
if (association instanceof BELONGSTOMANY) {
|
||||
names.add(association.getThroughName());
|
||||
const throughName = association.getThroughName();
|
||||
throughName && names.add(throughName);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
|
Loading…
Reference in New Issue
Block a user