【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

相关推荐
老纪的技术唠嗑局13 分钟前
OceanBase PoC 经验总结(二)—— AP 业务
数据库
阿里云大数据AI技术1 小时前
OpenSearch 视频 RAG 实践
数据库·人工智能·llm
m0_623955663 小时前
Oracle使用SQL一次性向表中插入多行数据
数据库·sql·oracle
阿蒙Amon4 小时前
C#读写文件:多种方式详解
开发语言·数据库·c#
东窗西篱梦4 小时前
Redis集群部署指南:高可用与分布式实践
数据库·redis·分布式
就是有点傻5 小时前
C#如何实现中英文快速切换
数据库·c#
1024小神5 小时前
hono框架绑定cloudflare的d1数据库操作步骤
数据库
KellenKellenHao7 小时前
MySQL数据库主从复制
数据库·mysql
@ chen7 小时前
Redis事务机制
数据库·redis
KaiwuDB8 小时前
使用Docker实现KWDB数据库的快速部署与配置
数据库·docker