You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Foo entity with a OneToOne relation to a Bar entity.
When hard-deleting Foo, Bar is deleted due to having deleteRule: 'cascade'.
When soft-deleting Foo, Bar is not deleted and it's deletedAt property is not updated, only Foo's deletedAt.
HOWEVER: If I attempt to fetch Bar, the orm doesn't find it, even when its deletedAt property is still undefined. If I disable filters, it's fetched correctly.
So it seems it's working half way. Am I missing something? Is there a standardized way I should be cascading soft deletions? I'm only using deleteRule: 'cascade'. No orphan removal.
The text was updated successfully, but these errors were encountered:
Jcalcaldev
changed the title
Relationships not updated correctly.
Relationships not updated correctly
Feb 23, 2024
I'm not pretty sure whether the deletedAt property of the relation entity should be updated. Currently, since we have filtered out all the deleted Foo entities from the queries, the Bar entity is expected not to appear in the query result, and I think it is an acceptable behavior since it makes it easier to recover soft-deleted entities - you only need to set deletedAt to undefined on one entity.
I do understand that it might be confusing at the data level, since the entity is in fact soft-deleted but its deletedAt property does not have a value, but currently I don't find a good reason to update the behavior.
Please let me know if there are any other troubles caused by this behavior.
I have a Foo entity with a OneToOne relation to a Bar entity.
When hard-deleting Foo, Bar is deleted due to having deleteRule: 'cascade'.
When soft-deleting Foo, Bar is not deleted and it's
deletedAt
property is not updated, only Foo'sdeletedAt
.HOWEVER: If I attempt to fetch Bar, the orm doesn't find it, even when its
deletedAt
property is still undefined. If I disable filters, it's fetched correctly.So it seems it's working half way. Am I missing something? Is there a standardized way I should be cascading soft deletions? I'm only using deleteRule: 'cascade'. No orphan removal.
The text was updated successfully, but these errors were encountered: