I'm using symfony 1.4 and doctrine. I've spent the last couple days playing with my schema, and I've gotten it to load up / build / behave properly but only on my local machine. When I copy the files to an account on Dreamhost, change the configuration to allow a connection to that database (and nothing else) I get the following error trying to delete something which should cascade (and does when I delete it on my local machine):
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent
row: a foreign key constraint fails (`ezshirtdb`.`item_options`, CONSTRAINT
`item_options_item_id_items_id` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`))
This 开发者_StackOverflowis my schema: http://pastie.org/1097068
These are my fixtures: http://pastie.org/1097072The tables in the dreamhost DB are all InnoDB, the database itself seems to be MYISAM. Is that an issue? In this case, I can't delete Item #1, which has ItemOptions associated onto it, or any of the categories (which have items associated).
I'm totally lost, and could use a couple pointers. Thanks y'all.
I got errors like this a while back, and it was due to the foreign key being a different integer size after being generated.
Take a look at the database, and ensure that both the Items.ID field, and the ItemOptions.item_id field are the same type.
Delete the database and create it again. MyISAM or InnoDB, is irrelevant.
精彩评论