About data merging
We assume that data from our API is used by third-party services.
That means we have to give them mechanisms to see changes to our objects.
We have some built-in utility fields,
showing when and who created/updated objects.
There are situations when the user of our system makes duplicates in his data,
this means that two identical business objects were created and these objects have been exported to other systems,
where someone could manage to use these objects in some logic.
For example, we have a "shared property object" (
Property
), and the user mistakenly created duplicates of this object
with the same address. This got into the billing systems,
and there they had already managed to link Personal Accounts
(BillingAccount
/ BankingAccount
) to the objects, and the customers had already managed to make payments(Payment
).In fact, we have to make a procedure of merging two identical objects.
To do this, we delete one of the objects (it doesn't matter which one) and put
newId
fields in it.There are situations where we decide that the objects are too different and are no longer the same entity.
For example, we have a "Building" object that has the attribute "building_type",
it can take the values "indoor parking", "apartment building", "freestanding parking".
After some time, we realized that objects with the attribute "inner parking" are independent business entities
and have their own life cycle. We need to migrate the data.
To do the migration, we create a new business entity "Indoor Parking",
where one of the attributes indicates a "Building" to which this parking refers.
The old business entities need to be removed and the newId and newType fields need to be put in them.