...
HistoryModel
Field in HistoryModel:
UUID (char(36UUIDField))**
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)
UUID is generated (on database level ? Dragos Dobre ?)by database
update:
DateCreated (date)**
DateUpdated (date)**
UserUpdatedUUID (fk users)**
UserCreatedUUID (fk users)**
version = 1
...
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
HistoryModel fields
DateValidFrom (date)*
DateValidTo (date)
UUIDReplacement (varchar 36) (to be confirmedReplacementUUID (UUID)
Actions
on create: same as HistoryModel
...
on Delete: same as HistoryModel
on Replace
update the fields for the to be replacecreate the new entity
save the action in the history log (django-simple-history)
check that the version save is still the same as the one in-memory
updateUUID is generated on database level
Update
DateCreated (date)**
DateUpdated (date)**
UserUpdatedUUID (fk users)**
UserCreatedUUID (fk users)**
version (+1)
ValidityTo set to ValidityFrom the new entity
= 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)
UUID is generated (on database level ? Dragos Dobre ?)
Update
DateCreated (date)**check that the version save is still the same as the one in-memory
update
DateUpdated (date)**
UserUpdatedUUID (fk users)**UserCreatedUUID
version (fk users+1)**
version = 1
check that
DateValidFrom is not empty
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