...
Field in HistoryModel:
UUID (UUIDField)**
isActive isDeleted (bool)** default false
Json_ext (json)
DateCreated (date)**
DateUpdated (date)**
UserUpdatedUUID (fk users)**
UserCreatedUUID (fk users)**
...
save the action in the history log (django-simple-history)
check that the version save is still the same as the one in-memory
update the fields
DateUpdated (date)**
UserUpdatedUUID (fk users)**
version (+1)isActive
isDeleted to false()True
HistoryBusinessModel
Field in HistoryBusinessModel
...
create the new entity
save the action in the history log (django-simple-history)
UUID is generated on database level
Update
DateCreated (date)**
DateUpdated (date)**
UserUpdatedUUID (fk users)**
UserCreatedUUID (fk users)**
version = 1
check that
DateValidFrom is not empty
update the fields for the entity to be replaced (ri)
save the action in the history log (django-simple-history)
check that the version save is still the same as the one in-memory
update
DateUpdated (date)**
UserUpdatedUUID (fk users)**
version (+1)
DateValidTo set to DateValidFrom the new entity(ni) if ni.DateValidFrom < ri.DateValidTo or ri.DateValidTo is null
ReplacementUUID set to UUID of new entity (to be confirmed)
...