If you use phpMyAdmin, there's a nifty "Relation view" link underneath the table structure when viewing InnoDB tables. This makes it super easy to set up foreign keys.
--
-Hector
On Fri, Oct 17, 2008 at 9:25 AM, Bill Karwin <bill@karwin.com> wrote:
On Oct 17, 2008, at 9:15 AM, EducatedFool wrote:This is best handled by a foreign key constraint with the ON DELETE RESTRICT modifier. You must use a storage engine that supports foreign key constraints. MyISAM cannot do this, but InnoDB can. There's no way to do this atomically in client-side code.
Another question. Is there something in the zend framework where: when I
want to delete something it checks if the value is used in another table,
and don't delete it when it is.
e.g. table with articles. Every articles is connected with a category. when
I try to delete a category, it 'll check if that id is used in the table
articles. If used, it 'll not delete it. If not used, the category can be
deleted.
Regards,
Bill Karwin
--
-Hector
没有评论:
发表评论