讓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