Home > Net >  How can I save Pending Changes?
How can I save Pending Changes?

Time:01-09

I have a SQL table Infos that stores some user information, the user can update his data but needs Administrator validation first, the primary key of Infos is the referenced a lot in some others tables

Wy question is where chould I store the pending information that need validation ?

Is it a good idea to store them as JSON in a column ?

CodePudding user response:

Treat this as a data modeling question. If the user information requires validation before it can be used in the application, introduce a Infos_UpdateRequest table or somesuch, that the administrator can use, and if approved copy the values from there to Infos.

CodePudding user response:

You could create an Infos_Pending table with the same schema as Infos and the primary key being also a foreign key to Infos. So, your admins could load the pending records:

  • approval would first update the Infos record with the Infos_Pending values and then delete the Infos_Pending record
  • rejection would simply remove the Infos_Pending record

CodePudding user response:

I would look at adding a pending approval and is active column to your table. It would then be easy to identify which of your rows should be displayed. You could even keep older rows around for undo/history purposes. This would mean you'd need to make changes to the sprocs/code used at your display layer, though. I would suggest not using json or xml unless it's a situation where you always intend to chnage the entire set of values in contains.

  • Related