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


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

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM