Import regression fix (in "next") (#224)
Import regression fix (in "next")
This commit is contained in:
commit
3da7cf22cd
@ -128,10 +128,26 @@ function removeColumnDefaultProperties(
|
||||
});
|
||||
return dbModel;
|
||||
}
|
||||
|
||||
function findFileImports(dbModel: Entity[]) {
|
||||
dbModel.forEach(entity => {
|
||||
entity.relations.forEach(relation => {
|
||||
if (
|
||||
relation.relatedTable !== entity.tscName &&
|
||||
!entity.fileImports.some(v => v === relation.relatedTable)
|
||||
) {
|
||||
entity.fileImports.push(relation.relatedTable);
|
||||
}
|
||||
});
|
||||
});
|
||||
return dbModel;
|
||||
}
|
||||
|
||||
function addImportsAndGenerationOptions(
|
||||
dbModel: Entity[],
|
||||
generationOptions: IGenerationOptions
|
||||
): Entity[] {
|
||||
dbModel = findFileImports(dbModel);
|
||||
dbModel.forEach(entity => {
|
||||
entity.relations.forEach(relation => {
|
||||
if (generationOptions.lazy) {
|
||||
|
@ -207,20 +207,6 @@ export default abstract class AbstractDriver {
|
||||
);
|
||||
await this.DisconnectFromServer();
|
||||
dbModel = AbstractDriver.FindManyToManyRelations(dbModel);
|
||||
dbModel = AbstractDriver.FindFileImports(dbModel);
|
||||
return dbModel;
|
||||
}
|
||||
|
||||
private static FindFileImports(dbModel: Entity[]) {
|
||||
dbModel.forEach(entity => {
|
||||
entity.relations.forEach(relation => {
|
||||
if (
|
||||
!entity.fileImports.some(v => v === relation.relatedTable)
|
||||
) {
|
||||
entity.fileImports.push(relation.relatedTable);
|
||||
}
|
||||
});
|
||||
});
|
||||
return dbModel;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user