So, I’m constructing a MYSQL database. In this database, a table called pendingArchives exists. Until an administrator can approve an archived file, it remains “unapproved”, or “0” as it’s an integer field. However, my question to you all is whether or not a record should be removed from the pendingArchives table once it has been approved. As of now, I am simply setting the approved field to have a value of “1” which means that it has been approved.
So, please let me know, which is the more agreed upon method, simply setting the approved value to 1, or moving the record to a completely new approved table?
You can let it act as a history table and not delete any record, as well as rename it to
archiveStatusOr you can create a new table named
archiveHistoryand move it there.For both cases, make sure that there’s a date column for the approval date, and have a trigger ready to modify it whenever a
statuscolumn (for approved and unapproved values) is modified.[edit / additional]
In my experience, tracking activities is one of the best pleasures a DBA where I used to work at would like to have. With data warehouses, other VLDBs and users who almost always question reports, we like to show this kind of evidence that an action has been taken, then confirmed, then backed up or implemented further to the users. With secured tables in which only jobs or SSIS package runs can modify, loading of data, correcting of data, insertion of data gets logged, as well as all other changes like database backup start and end times, execution results, who ran what when and from where.. It’s always good to have a way to track things. Avoid deleting unless the circumstance calls for it (erroneous insertion resulting in duplicates, for example) but still log the activities. In those cases, it’s okay to admit a mistake, as long as the steps to rectify are confirmed and that there is always solid evidence to back it up. Another thing.. for the DBA team and management, you can even make a report out of properly set-up tracking tables.