So let\'s say I have a DB table with 8 columns, one is a unique auto-incrementin
ID: 651040 • Letter: S
Question
So let's say I have a DB table with 8 columns, one is a unique auto-incrementing used as ID. So I have a page that pulls in the info for each row based on query string ID. I want to give my users the ability to propose changes. Kinda like a wiki setup. So I was thinking I should just have another duplicate table or maybe database altogether (without the auto-incrementing column and maybe with a date edited column) that keeps all proposed changes in queue and then when I approve them, the script can move the row from the proposed DB to the real DB.
Does this sound good or is there a better process for this?
Explanation / Answer
You have the right idea, but I would make the suggested edit table a bit differently. Your suggested edit table should include an auto increment key because there is no good reason not have one one as at least part of a key for any table. It should also have the key to the other table as a FK and a column for each of the columns users would be allowed to suggest edits to. Finally, there should be some audit columns, created date, modified date, created by, modified by, and a suggestion status column (accepted,rejected,pending). So your suggested edit table would look like:
PK | FK | other 7 columns | createdBy | CreatedDate | modifiedBy | modifieddate | Status
This will allow you to keep a detailed record of who suggested what and when and what gets approved/rejected and when. This also makes it trivial to create a script to update the table used for display with the edited columns when they become approved.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.