Archive for October, 2007
Managing deleted records in a mysql database – Design Patterns and Best Practices
Posted by admin in entrepreneurs on 31Oct07
It’s a classic problem in application design – you’ve got a nicely normalized database, lots of tables with related records. You need to allow the user to delete a top-level object – which OUGHT to produce some cascading deletes through a bunch of tables. BUT! – you don’t trust the user. So you need to support some kind of undelete, some kind of audit trail. What to do?
1. Have another table for each table, and create “deleted” records in there.
2. Have a “deleted” column on each table.
Both have their challenges. When rapid prototyping, the first one is cumbersome because you need to remember to make data model changes in two places, ensuring data integrity between current and deleted data, etc. But the second one would seem to require an extra WHERE clause for every SELECT statement in the entire application.
MySQL 5.0 comes to the rescue with support for VIEWS. Simply define a mirrored view for each table, such that:
CREATE view bounties as SELECT * from bounty where deleted = 0;
Obviously CRUD needs to be executed against the underlying table, but now you can safely declare simple SELECT statements everywhere.
I’m considering a similar approach, using nested VIEWs, to address Adult Filters. I’ll let you know how that goes.
Blogged with Flock
If it’s revolutionary, it’s probably confusing
Posted by admin in entrepreneurs on 31Oct07
The reason, I think, that the history of human development has been one of evolution, and not revolution, is simple: anything radically new, is by definition hard to explain. That’s because it lacks context – there’s nothing else quite like it. Explanations are easiest by comparison.
And so we compare the revolutionary to the soup de’ jour, and the explanation dumbs our revolution down – a little bit each time, until we reach that magical threshold where it’s no longer indigestible, because the tide in the sea of collective understanding has come in.
Losing faith in Xname
Posted by admin in Uncategorized on 01Oct07
For the past few years, I’ve been a devout advocate for xname.org, a relatively small, free dns provider based somewhere in the UK. I have always liked their web interface, they seem to understand what they’re doing, and my dnsreport has been reasonably clean. But today, they failed me.
For some bizarre reason, they simply dropped my bountyup.com domain name overnight. It still showed up in the web interface, but their name servers wouldn’t answer any queries for it. (And no, the servers weren’t down, as other names I had registered with them worked perfectly.) So I’ve left them.
I’ll be on the lookout for another simple, free provider, but in the meantime I’m back to using my father-out-law’s DNS servers (in Iowa, of all places).