在DELETE CASCADE上删除 [英] remove ON DELETE CASCADE

查看:61
本文介绍了在DELETE CASCADE上删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个儿童桌子.并在创建表时使用ON DELETE CASCADE在那里使用外键.

I have a child table. and foreign key there with ON DELETE CASCADE while creating the table.

子表或父表中没有记录.

There are no records either in child or parent table.

我希望主键,外键保持原样,但只希望从子表中删除CASCADING选项.

I want the primary key, foreign key to be as they are but want to remove only the CASCADING option from the child table .

无论如何,我可以更改该子表.

is there anyway that i can Alter that child table.

谢谢.

推荐答案

  • 将数据库导出为 .sql 文件
  • 然后按 ctrl + H 将所有 ON DELETE CASCADE 替换为".
  • 然后从数据库中删除表,并使用新文件实例化一个新文件,而无需 ON DELETE CASCADE
    • Export the database as a .sql file
    • Then press ctrl + H to replace all ON DELETE CASCADE with ""
    • Then drop the tables from the DB and use the new file to instantiate a new one without ON DELETE CASCADE
    • 这篇关于在DELETE CASCADE上删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆