> I'm thinking of changing my typical "Delete" button so that
> it doesn't actually delete a record, but rather flags it as
> a record to be ignored. I'd also record the date/time that
> it was flagged. That way I can offer the user the opportunity
> to Undo the Delete. I'll probably schedule a job to delete all
> records which have been flagged for more than 1 day.
This is a pretty common practice. It's often called a "soft delete".
There are a couple of alternative ways you can handle soft deletes. One way
is to simply have a column within the table that tracks the "deleted" status
for a record. For example, we generally track four pieces of information in
addition to the regular data:
1. The date a record was created
2. The date a record was last modified
3. The date a record was deleted
4. The ID of the last user to modify the record
Then, any queries that show active records check the End_Date field to see
if it contains NULL.
However, if you expect to have a lot of deletions within your data, you
might be better off by moving the "deleted" records to an alternative table.
> Here's another use for flagging records: Our db tables which
> contain scientific data contain an "approved" field, whose
> default value is "false". After data is inserted into the
> database, an analyst checks it out, and then we toggle the
> flag to "true". Of course, our non-admin canned queries all
> include "WHERE approved = true".
This is a good place to use views. You can create views for these tables
using this WHERE clause, and allow end users to run whatever queries they
want.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists