This topic is locked

No Foreign Keys in SQL?

10/28/2008 6:01:49 AM
Shopping Cart Template general questions
K
kenlyle author

I am trying to learn how PHPR works, and have what may be a noobish question:
I noticed that there are lots of relationships in the date in the shopping cart template, but there are no Foreign Keys defined in the .sql
Would it be better, in some architectural sense or in principle, to keep the relationships and FK checks, etc. in the database rather than in the generated application? It seems that then, the application could automatically define the Master-Detail relationships. Or are there issues like MySQL version differences, which make it impossible?
As I edit the db in my schema designer, trying to view FKs it says that only InnoDB supports FKs, which may answer the question...and in PHPMyAdmin "PMA Database ... not OK[ Documentation ]

General relation features Disabled"
Still, when creating the project, why not detect MySQL 5 or whatever version has the more advanced features, and use InnoDB automatically, or at least suggest/notify of the availability of the feature? Would it be more robust to have different .sql files for different MySQL versions that handle referential integrity differently, i.e. automatically, and make it an option to use those more advanced features when the database is built?
I am just curious why the design is like this, and whether what I suggest makes sense, and can be considered for future versions.
Thanks,

Ken

J
Jane 11/6/2008

Ken,
thank you for sharing your ideas.

We'll add it to our suggestion list.

J
jams002 12/17/2008

thanks for sharing this kind of info,
___

Great thing to know about busby seo test.

E
excini 6/13/2009

Thanks for the response. I now understand how I can use foreign keys better. I understand that foreign keys can only be referenced to primary keys. For argument sake, if I had added another table Customer table with Customer_Name and Order No.....would it be right/best practice in coding as below to have an acceptable relation.
CODE