Hi,
For some reasons, this part of the sql command won’t work
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
Hi,
For some reasons, this part of the sql command won’t work
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
If you are using the MySQL command line client when entering such statements, you may need to alter all of the single quote characters from
'
to
`
Otherwise, are you using MySQL? What version?
I finally solved it.
Strange, I emptied the whole database and pasted everything, but that same FK_user_project won’t work.
I decided to delete the whole database instead of just emptying it and it worked.
I don’t know why. It must have turned corrupted.
Thanks for your reply.
I am having the same problem. I am using phpmyadmin. First I had to remove all the single quotes. It finally created the tables, but now I am stuck at altering the tables. I have deleted the whole database as corbeeresearch suggested, to no avail.
This is the error message I am receiving:
SQL query:
ALTER TABLE tbl_issue ADD CONSTRAINT FK_issue_project FOREIGN KEY(project_id) REFERENCES tbl_project(id) ON DELETE CASCADE ON UPDATE RESTRICT ;
MySQL said:
#1005 - Can’t create table ‘test.#sql-10e0_c4’ (errno: 150)
Any suggestions,
Thanks
Ok. I got it. For some reason my project table was not set as InnoDB. Once I set that and removed all the single quotes, it worked in phpmysql and trough netbeans IDE.