[development] Have you ever laughed fate in the face?

Larry Garfield larry at garfieldtech.com
Fri Jul 21 02:07:47 UTC 2006

On Thursday 20 July 2006 12:26, Dries Buytaert wrote:

> Why don't we add a status-field with two states -- STATUS_ACTIVE and
> STATUS_DELETED -- to each of the database tables with records that
> want to take advantage of the trashbin functionality?  Then, the
> trashbin patch might be a lot easier to grok -- and from an
> architectural point of view, less awkward.  It wouldn't be
> particularly clever but that is OK: it is super-easy so there is no
> point being clever to begin with.  I'd like to see us explore this
> path instead.
> Plus, this has a number of advantages.  Most of all, we'd still able
> to query deleted data.  For example, the filter form on the
> administer content page (?q=admin/content) would allow us to access
> delete nodes and we'd be able to use advanced query methods like
> 'show all deleted nodes from user Joe with the taxonomy term
> 'Apple'.  That is, we get to reuse a lot of the existing UIs and
> modules.

While I've done the "timestamp as deleted flag" trick before myself and it's 
worked well, it does have one notable drawback: It becomes opt-out.

Adding a "Deleted" column to node, comment, and various other tables means 
that every query against those tables would have to be modified to add "WHERE 
deleted=0".  Between core and contrib, that's thousands of queries that would 
need to be updated.  

Granted, the update is smaller than, say, the Forms API conversion, which also 
broke everything in one fell swoop.  But that was replacing one method of 
doing X with a different, better method of doing X.  Once the transition 
is/was complete, there's not an unreasonably larger amount of work to do 
(IMHO) than before.  However, a deleted flag column would essentially mean 
99% of all entity queries (node, comment, user) from now on would have to 
remember to check "WHERE deleted=0".  Do we really want to introduce that 
extra step?

I'm not giving this thumbs up or down, just pointing out that there are more 
costs involved in such a mechanism than tweaking a few queries in the patch.

Larry Garfield			AIM: LOLG42
larry at garfieldtech.com		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 

More information about the development mailing list