Adding field to model raises `django.db.utils.OperationalError: no such column` during `makemigrations`

Every time I try python3 manage.py makemigrations after adding a new field to my model, I get an error:

django.db.utils.OperationalError: no such column: network_user.following

The database used in the project is sqlite3.

This is what I had in models.py when I've already created users:

class User(AbstractUser):
    pass

And this what I wanted to get after adding a new field:

class User(AbstractUser):
    following = models.CharField(default='', max_length=1000000)

I've checked through a lot of posts on this problem. And the only solution I found was to delete the database and clear the migration files in Django project. This method works, but you lose all the data.

Вернуться на верх