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

created at 07-17-2021 views: 1

description

In the test project, the database: sqlite, an error is prompted when the table name is modified:

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 does not support renaming the apps_article table in a transaction because it will break referential integrity. Try to add atomic = False to the Migration class.

Solution

File path: project path \apps\migrations\0006_auto_20190708_1144.py

from django.db import migrations


class Migration(migrations.Migration):
    atomic = False  # Add atomic
    dependencies = [
        ('apps', '0005_auto_20190701_2022'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='article',
            options={'ordering': ['-pub_date'], 'verbose_name': 'article table', 'verbose_name_plural': 'article table'},
        ),
        migrations.AlterModelTable(
            name='article',
            table='article',
        ),
    ]
Please log in to leave a comment.