django.db.utils.NotSupportedError in sqlite why not supported in sqlite django.db.utils.NotSupportedError in sqlite why not supported in sqlite django django

django.db.utils.NotSupportedError in sqlite why not supported in sqlite


Go to related migration file(automatically created in migrations directory after makemigrations command) and add atomic = False to the Migration class. Migration(migrations.Migration):. Then you can migrate the changes.

example code:

# Generated by Django 2.1.14 on 2019-12-02 07:07from django.db import migrations, modelsclass Migration(migrations.Migration):    atomic = False # **<<< HERE**    initial = True    dependencies = [    ]    operations = [        migrations.CreateModel(            name='ebayLog',            fields=[


If you still have the problem here is a example:

# Generated by Django 2.1 on 2018-08-16 21:22from django.db import migrationsclass Migration(migrations.Migration):    atomic = False # <<<< THIS LINE    dependencies = [        ('shop', '0004_product_imgfeat'),    ]    operations = [        migrations.RenameModel(            old_name='Category',            new_name='CategoryShop',        ),    ]


I migrated many times after I got this error.

Then I did what Selim said above and I also added atomic = False after class Migration(migrations.Migration): in every migration file, which was a little silly because I didn't know which file was THE related migration file...

Then I searched the "atomic=False" in Django documentation and I found these:12

As the error "Renaming the 'posts_file' table while in a transaction is not supported on SQLite" described we know that renaming while in a transaction is not supported on SQLite, so adding atomic=False is needed. But I don't know about DDL transactions so that's too much for me...