首页 > 数据库技术 > 详细

让SQLite数据库中表名支持重命名的方法

时间:2020-06-26 17:51:51      阅读:83      评论:0      收藏:0      [点我收藏+]

修改了数据库表名之后,更新数据库时跳错:

django.db.utils.NotSupportedError: Renaming the ‘app_class‘ table while in a transaction is not supported on SQLite because it would break referential integrity. Try adding atomic = False to the Migration class.

意思就是 SQLite 数据库不支持重命名的操作,添加atomic = False即可:

Migration 在 \py36\Lib\site-packages\django\db\migrations\migration.py 的位置

atomic = True 改成 atomic = False

让SQLite数据库中表名支持重命名的方法

原文:https://www.cnblogs.com/JeromeLong/p/13195485.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!