I made the column deleted and the DeletedDate column. Deleted by default false and the deleted date is empty.
Complex primary key for IDColumn, Deleted and DeletedDate.
You can index by remote so that you have very fast queries.
There is no duplicate primary key in your IDColumn, because your primary key contains deleted and deleted dates.
Assumption: you will not record more than one millisecond in the same record. May cause a recurring primary key problem if the deleted date is not unique.
Then I make a transaction with the type of transaction for updates: I select a row, get results, update specific values, then insert. Indeed, this is updating the deleted truly remote date to now (), after which you post the line after the update and use it to get the primary key and / or any values that are not available for any API that you created.
Not as good as a temporary table and requires some discipline, but it combines history into 1 table, which is easy to report on.
I can start updating the deleted date column and change it to added / deleted in addition to the added date so that I can sort the records by 1 column, added / deleted column, while always updating the AddedBy column and just setting the same value as the added ./ Removed column for registration for the sake of.
In any case, you can simply perform the difficult case when the null value is not null, since addDate is still added in the order of adding the added date, as added by the added date. so yes, whatever, it works.
source share