refactor: add isParent flag to O2O relationships

It allows to identify the side with the FK when isParent == False
This commit is contained in:
Laurence Isla
2024-05-21 12:11:27 -05:00
committed by GitHub
parent 04d6f41f45
commit 7671d63f06
5 changed files with 33 additions and 32 deletions
+3 -3
View File
@@ -114,9 +114,9 @@ makeProperty tbl rels col = (colName col, Inline s)
relsSortedByIsView = sortOn relFTableIsView [ r | r@Relationship{} <- searchedRels]
-- Finds the relationship that has a single column foreign key
rel = find (\case
Relationship{relCardinality=(M2O _ relColumns)} -> [colName col] == (fst <$> relColumns)
Relationship{relCardinality=(O2O _ relColumns)} -> [colName col] == (fst <$> relColumns)
_ -> False
Relationship{relCardinality=(M2O _ relColumns)} -> [colName col] == (fst <$> relColumns)
Relationship{relCardinality=(O2O _ relColumns False)} -> [colName col] == (fst <$> relColumns)
_ -> False
) relsSortedByIsView
fCol = (headMay . (\r -> snd <$> relColumns (relCardinality r)) =<< rel)
fTbl = qiName . relForeignTable <$> rel