在MySQL中可以暂时禁用约束吗?
我有两个Django模型,每个都有一个ForeignKey,另一个。删除模型的实例将返回一个错误,因为ForeignKey约束:
cursor.execute("DELETE FROM myapp_item WHERE n = %s", n)transaction.commit_unless_managed() #a foreign key constraint fails herecursor.execute("DELETE FROM myapp_style WHERE n = %s", n)transaction.commit_unless_managed()
是否可以暂时禁用约束并删除?
茅侃侃
相关分类