disable generating complex relationships

until they're not generated completly
This commit is contained in:
Kononnable 2019-08-19 21:45:12 +02:00
parent 07d82714d7
commit 9d49fd3ee7

View File

@ -216,6 +216,33 @@ export default abstract class AbstractDriver {
entities: EntityInfo[]
) {
relationsTemp.forEach(relationTmp => {
if (relationTmp.ownerColumnsNames.length > 1) {
const relatedTable = entities.find(
entity => entity.tsEntityName === relationTmp.ownerTable
)!;
if (
relatedTable.Columns.length !==
relationTmp.ownerColumnsNames.length * 2
) {
TomgUtils.LogError(
`Relation between tables ${relationTmp.ownerTable} and ${relationTmp.referencedTable} wasn't generated correctly - complex relationships aren't supported yet.`
);
return;
}
const secondRelation = relationsTemp.find(
relation =>
relation.ownerTable === relatedTable.tsEntityName &&
relation.referencedTable !== relationTmp.referencedTable
)!;
if (!secondRelation) {
TomgUtils.LogError(
`Relation between tables ${relationTmp.ownerTable} and ${relationTmp.referencedTable} wasn't generated correctly - complex relationships aren't supported yet.`
);
return;
}
}
const ownerEntity = entities.find(
entitity => entitity.tsEntityName === relationTmp.ownerTable
);