1
0
Fork 0
mirror of synced 2024-07-03 05:20:32 +12:00

1-n-data-integrity

This commit is contained in:
Martin McKeaveney 2021-02-25 11:05:15 +00:00
parent 8e0aaf0daa
commit 19fb11e69d

View file

@ -132,6 +132,14 @@ class LinkController {
const rowField = row[fieldName]
const field = table.schema[fieldName]
if (field.type === FieldTypes.LINK && rowField != null) {
// if 1:N, ensure that this ID is not already attached to another record
const linkedTable = await this._db.get(field.tableId)
const linkedSchema = linkedTable.schema[field.fieldName]
if (linkedSchema.relationshipType === "one-to-many") {
}
// check which links actual pertain to the update in this row
const thisFieldLinkDocs = linkDocs.filter(
linkDoc =>