1
0
Fork 0
mirror of synced 2024-10-02 18:16:29 +13:00

Merge pull request #12355 from Budibase/fix/relationship-selection-issues

Fix issue in relationship definitions where primary / foreign key selection didn't trigger properly
This commit is contained in:
Michael Drury 2023-11-10 11:12:55 +00:00 committed by GitHub
commit cf0e1cd199
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,6 +33,10 @@
part1: PrettyRelationshipDefinitions.MANY,
part2: PrettyRelationshipDefinitions.ONE,
},
[RelationshipType.ONE_TO_MANY]: {
part1: PrettyRelationshipDefinitions.ONE,
part2: PrettyRelationshipDefinitions.MANY,
},
}
let relationshipOpts1 = Object.values(PrettyRelationshipDefinitions)
let relationshipOpts2 = Object.values(PrettyRelationshipDefinitions)
@ -58,7 +62,7 @@
let fromPrimary, fromForeign, fromColumn, toColumn
let throughId, throughToKey, throughFromKey
let isManyToMany, isManyToOne, relationshipType
let relationshipType
let hasValidated = false
$: fromId = null
@ -85,8 +89,9 @@
$: valid =
getErrorCount(errors) === 0 && allRequiredAttributesSet(relationshipType)
$: isManyToMany = relationshipType === RelationshipType.MANY_TO_MANY
$: isManyToOne = relationshipType === RelationshipType.MANY_TO_ONE
$: isManyToOne =
relationshipType === RelationshipType.MANY_TO_ONE ||
relationshipType === RelationshipType.ONE_TO_MANY
function getTable(id) {
return plusTables.find(table => table._id === id)
}