Skip to main content

Deletion while in use

A record cannot be deleted while it is being referenced by another record.

Here, deletion refers to a modification of type DELETE being added to the transaction stream for a record. As the transaction stream is an append-only log, no past modifications are ever actually deleted.

A record is being referenced by another record if its identifying fields are present in the current version of the other record and the other record is in a different record type.

The validity dates of the referencing record are not relevant; a record is still being referenced even if the referencing record has expired.

Previous versions of records or DELETE records are also not considered; a referencing record is no longer referencing another record if a modification is made to remove the identifying fields of the referenced record (either by removing them or by referencing a new record).

A record is not considered to be referenced by its own subrecords. For example: if a record has a description then the record is not referenced by the description and can be deleted even if there are current description records.

To avoid firing this validity rule, all referencing records must either have an UPDATE that removes the reference or themselves have a DELETE.

This rule ensures that systems using the data always have all of the information they need and that the meaning or function of a referencing record is never ambiguous.

Examples

A certificate type S is referenced by a certificate S001. If a transaction is emitted that contains a DELETE for certificate type S, the transaction would fail this validity rule because S is referenced by S001.

Certificate S001 is updated to change its validity dates to be in the far past. A transaction deleting S would still fail this validity rule.

Certificate S001 is then deleted. A transaction that contains a DELETE for S would now pass this rule because it is no longer being referenced.