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

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

html 复制代码
django.db.utils.NotSupportedError: Renaming the 'japi_api_info' table while in a transaction is not supported on SQLite < 3.26 because it would break referential integrity. Try adding `atomic = False` to the Migration cl
ass.

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

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

将 atomic = True 改成 atomic = False

相关推荐
husterlichf几秒前
MYSQL 常用字符串函数 和 时间函数详解
数据库·sql·mysql
hnlucky25 分钟前
redis 数据类型新手练习系列——Hash类型
数据库·redis·学习·哈希算法
LucianaiB1 小时前
【金仓数据库征文】_AI 赋能数据库运维:金仓KES的智能化未来
运维·数据库·人工智能·金仓数据库 2025 征文·数据库平替用金仓
时序数据说2 小时前
时序数据库IoTDB在航空航天领域的解决方案
大数据·数据库·时序数据库·iotdb
.生产的驴2 小时前
SpringBoot 封装统一API返回格式对象 标准化开发 请求封装 统一格式处理
java·数据库·spring boot·后端·spring·eclipse·maven
AnsenZhu2 小时前
2025年Redis分片存储性能优化指南
数据库·redis·性能优化·分片
oydcm2 小时前
MySQL数据库概述
数据库·mysql
oioihoii2 小时前
C++23中if consteval / if not consteval (P1938R3) 详解
java·数据库·c++23
带娃的IT创业者3 小时前
《AI大模型趣味实战》基于RAG向量数据库的知识库AI问答助手设计与实现
数据库·人工智能
小杰love编程3 小时前
Django 入门指南:构建强大的 Web 应用程序
前端·django·sqlite