1-n-data-integrity
This commit is contained in:
parent
8e0aaf0daa
commit
19fb11e69d
|
@ -132,6 +132,14 @@ class LinkController {
|
||||||
const rowField = row[fieldName]
|
const rowField = row[fieldName]
|
||||||
const field = table.schema[fieldName]
|
const field = table.schema[fieldName]
|
||||||
if (field.type === FieldTypes.LINK && rowField != null) {
|
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
|
// check which links actual pertain to the update in this row
|
||||||
const thisFieldLinkDocs = linkDocs.filter(
|
const thisFieldLinkDocs = linkDocs.filter(
|
||||||
linkDoc =>
|
linkDoc =>
|
||||||
|
|
Loading…
Reference in New Issue