Ability to revert soft delete #522
Replies: 2 comments 1 reply
-
|
We currently really only support soft deletes in order to maintain data integrity, ensuring orders can continue to display relevant information even if the connected entity is deleted (ie, if order is placed using a payment method that is later deleted, we still need to report that the historic order used that payment method). As such, we don't really provide an ability to undelete and item. We could probably add some helper methods for this, but personally I think this is a bad idea to allow uSync to do this. If it has the ability to restore deleted items you could end up with some unexpected results where someone expects an item to be gone, but every restore keeps bringing it back. As an interm solution, clearing the |
Beta Was this translation helpful? Give feedback.
-
|
Hi! I think too, that it is better to create new one item rather than restoring the old one, but I have some doubts about that... When uSync does export, it stores id (key) of item, and when it does import it tries to create item with the same id (key) from export file. It is necessary to sync changes of this item in future imports. So if we will create on import new item (changing it id (key)), we will lose possibility to sync future changes, e.g.:
So instead to apply changes from instance A to item 2, we created item 3. Maybe better solution is to show error that we can't export this item due it soft deletion, but I think this kills uSync features... @KevinJump Can you please provide your point of view? Many thanks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I want to ask aboud an ability to change properties of
Umbraco.Commerce.Core.Models.StoreAggregateStateBaseclass and.I have tried
uSync.Umbraco.Commerceand I faced with some issues.Umbraco.Commerce has feature called "soft delete", it is when entity in db marked as deleted but not deleted actually. I understand for what it did, but this caused to uSync problems.
Let's look at
Umbraco.Commerce.Core.Models.OrderStatusclass for example. All information about this entity stored inUmbraco.Commerce.Core.Models.OrderStatusStateclass. It has properies which has internal set modifiers, it is good, but...Here is the problem:
OrderStatusA with id=1OrderStatusA (soft delete applied)OrderStatusA with id=1This was happened because of soft delete, and it is good.
So as I can see the best way to resolve this situation is to restore
OrderStatusA with id=1 from daleted state. All what we need to do is to changeOrderStatus's propertyDeletedTimestampto 0, but it hasinternal setmodifier andOrderStatusdoes not reveal propertyStatusout.So I understand that state is read only, but for this special case like uSync maybe we can create some sort of ability to restore soft deleted entities (e.g.: add
uSync.Umbaco.Commereto friendly assebly).btw I am not familiar with what happened if we did so (just reset
DeletedTimestampto 0). Is that enough or we should do more to safelly restore entities.@mattbrailsford I need your opinion in this situation.
Many thanks)
Beta Was this translation helpful? Give feedback.
All reactions