django.db.utils.NotSupportedError: Renaming the 'apps_article' table while in a transaction is not supported on

django.db.utils.NotSupportedError: Renaming the 'apps_article' table while in a transaction is not supported on ,第1张

概述django.db.utils.NotSupportedError: Renaming the 'apps_article' table while in a transaction is not supported on SQLite

在测试项目中,数据库:sqlite,修改表名时提示错误:

django.db.utils.NotSupportedError: Renaming the 'apps_article' 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 class.

中文意思:

sqlite不支持在事务中重命名apps_article表,因为它会破坏参照完整性。尝试添加atomic = False到Migration类。

解决方法:

文件路径:项目路径\apps\migrations\0006_auto_20190708_1144.py

from django.db import migrationsclass Migration(migrations.Migration):    atomic = False  # 添加atomic    dependencIEs = [        ('apps', '0005_auto_20190701_2022'),    ]    operations = [        migrations.AlterModelOptions(            name='article',            options={'ordering': ['-pub_date'], 'verbose_name': '文章表', 'verbose_name_plural': '文章表'},        ),        migrations.AlterModeltable(            name='article',            table='article',    ]


总结

以上是内存溢出为你收集整理的django.db.utils.NotSupportedError: Renaming the 'apps_article' table while in a transaction is not supported on SQLite全部内容,希望文章能够帮你解决django.db.utils.NotSupportedError: Renaming the 'apps_article' table while in a transaction is not supported on SQLite所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/langs/1229843.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-06
下一篇 2022-06-06

发表评论

登录后才能评论

评论列表(0条)

保存