views:

25

answers:

2

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 is my schema: http://pastie.org/1097068
These are my fixtures: http://pastie.org/1097072

The 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.

A: 

Delete the database and create it again. MyISAM or InnoDB, is irrelevant.

turbod
A: 

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.

Jon
I went back through the schema. It may have been a mismatched key like this, but I'm not sure. I was paying closer attention to setting up the Relations: properly, which I felt was the issue. Works now, thanks for pointing me into the schema.
Jordan
Great. The schema.yml file is quite strict and temperamental. Glad you got it figured out!
Jon