I have a migration script that reads from one DB and write to a second DB.
I usually update the existing records. How can I log the updates like:
productID : 125
title : Product1 => test update
price : 125 => 140
This means that the productID 125 had title "Products1" and became "test" after update and had price "125" which became "140"
One thought is to read the record keep the values and then update, read again the values and the compare and log what necessary fields.
Do any other methods exist?
You could use a trigger and store the changes in another table.
From the top of my head (the following assumes that productId never will be updated);