Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我第一次创建表时,我能够在列上添加外键约束,并且我已经创建了接受空值的列。
但是现在表中有数据,具有空值的实际记录,似乎我无法在其中一列上添加外键约束,因为有空值。
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
这有点痛苦,看来我可能会放弃在此列上放回外键。