Answer the question
In order to leave comments, you need to log in
ERROR 1215 (HY000): Cannot add foreign key constraint?
https://dev.mysql.com/doc/refman/5.6/en/create-tab...
mysql> ALTER TABLE user_notification_settings ADD CONSTRAINT FK_7051D51E4FBDA576 FOREIGN KEY (eid) REFERENCES events (id);
ERROR 1215 (HY000): Cannot add foreign key constraint
mysql> desc user_notification_settings; +--------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| uid | int(11) | YES | MUL | NULL | |
| eid | int(11) | YES | | NULL | |
| key | varchar(255) | YES | | NULL | |
| app | int(11) | YES | | NULL | |
| email | int(11) | YES | | NULL | |
| sms | int(11) | YES | | NULL | |
| last_changed | timestamp | YES | | NULL | |
+--------------+--------------+------+-----+---------+----------------+
8 rows in set (0.00 sec)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question