keymaster wrote: > A final question: how important are REAL foreign keys in the > database, if you are using cake associations. Are they superfluous? > Are they still needed?
On Jan 10, 2007, at 10:29 AM, Matt Adams wrote: > They are extremely important if your database offers read-write > access to more than one application from the same set of tables. A > large majority of those who have swallowed the Rails-like pill have > never worked with large-scale databases and do not understand the > necessity of enforcing integrity with foreign keys, triggers and > stored procedures. John David Anderson (_psychic_) wrote: > I've always had mixed feelings about this: in some ways using > triggers, stored procedures and the like seem to me like spreading > your application logic in too many places. I can see where they'd be > useful though, too. I understand the resistance to placing application logic in more than once place but in situations where two or three or more applications are accessing the same database it makes much more sense to enforce all of this in ONE place (i.e., the database) then to try and duplicate the same logic correctly through several different applications. Do you really want to trust the developers from several different teams to all interpret the schema correctly and enforce the correct data integrity rules for a shared database? Of course not, people make mistakes. That's why you have your DBA nail down how the relationships are going to be set up & used and enforce it in once place. That way the bug that some well-meaning developer in customer applications introduced doesn't mangle the in-house service data (assuming the two are connected in some way). Enforcing data integrity in the database isn't about application logic, per se although the two domains may have some degree of overlap - it's about making sure that two different applications with separate uses of the same data don't muck things up badly for the other team. > Just be sure your app knows how to deal with integrity failures. Mine might, but I don't want to count on the ugly piece of crap the bloke down the hall is writing. I write this full-knowing that I have been that guy down the hall from time to time. Cheers, Matt -- BASIC: A programming language. Related to certain social diseases in that those who have it will not admit it in polite company. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---