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.
我有两个表,每个都引用另一个(由 django ORM 创建)。每个表都引用另一个表。
现在我想编写一个删除所有表的脚本,但我没有这样做,因为我正在做外键违规
mysql> delete from table1 mysql> delete from table2
我知道我可以忽略这些检查,但问题是这些检查是由 django 生成的,具有神秘的名称
谢谢。
你可以这样做 -
SET FOREIGN_KEY_CHECKS = 0; DELETE FROM table1; DELETE FROM table2; SET FOREIGN_KEY_CHECKS = 1;
文档:foreign_key_checks。