Cannot change column used in a foreign key constraint

后端 未结 3 2053
北荒
北荒 2020-11-28 02:01

I got this error when i was trying to alter my table.

Error Code: 1833. Cannot change column \'person_id\': used in a foreign key constraint \'fk_fav_food_p         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 02:17

    You can turn off foreign key checks:

    SET FOREIGN_KEY_CHECKS = 0;
    
    /* DO WHAT YOU NEED HERE */
    
    SET FOREIGN_KEY_CHECKS = 1;
    

    Please make sure to NOT use this on production and have a backup.

提交回复
热议问题