In one of the earlier chapters in the book, we created the four tables and then did some Alters on the tables to set up indexes.
This one worked fine
ALTER TABLE `tbl_project_user_assignment` ADD CONSTRAINT `FK_user_project` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
But this one never worked for me
ALTER TABLE `tbl_project_user_assignment` ADD CONSTRAINT `FK_project_user` FOREIGN KEY (`project_id`) REFERENCES `tbl_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
Now I’m at chapter 7 and worrying there’s going to be consequences for me (i.e. the code won’t work somewhere soon) because this latter query never worked. I had originally tried it from the command line (on my MAMP) and now I just tried again with PHP My Admin and I got this error message
#1005 - Can't create table 'trackstar_dev.#sql-16c_13' (errno: 121) (<a href="server_engines.php?engine=InnoDB&page=Status&token=1e24d6ba9d7d4aec44779b38ad62ff8f">Details...</a>)
Does anyone know what’s wrong? And also, where is it going to affect my application if I don’t ever get it to work?