* Matt S Trout <[EMAIL PROTECTED]> [2007-01-23 11:00]: > On 22 Jan 2007, at 19:36, A. Pagaltzis wrote: > >I think it’s good practice to use surrogate keys in any case > >were you’re not absolutely and completely certain that the key > >can positively never ever ever change. > > Ah, the ActiveRecord/Jifty::DBI approach. Personally I've > always preferred to do actual database design.
On the project I am on, the client has so little understanding of the requirements of modelling their domain that we’ve had to remove the uniqueness on several fields that would have seemed like candidates for natural keys, and in some cases added it to other fields. Had I used any natural key, I’d’ve had a lot more fun migrating data than I’ve had anyway. If an actual immutable natural key presents itself, I wouldn’t have a problem using it. But that is rare. There are a bunch of other issues in this argument that I can only vaguely remember… it’s an old, old debate that seems to come down to a trade-off between various forms of purity. > And anyway, primary keys -are- allowed to change, else what's ON > UPDATE CASCADE for? Dunno, causing unnecessary updates on unrelated tables? :-) Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/> _______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
