0

we are upgrading our application from django 1.5 to django 1.10 , i am facing an issue with model migration like django db utils OperationalError: (1050, "Table 'auth_user' already exists") , when i perform the python manage.py migrate this will occur.

1 Answers1

2

The problem arises because Django 1.10 uses migrations by default to manage changes in the database schema. Since in 1.5 there was no such thing, your Django believes that all the migrations are pending, even the ones that create the initial database. Then, when you try do do makemigrations, it will fail.

The solution is to fake the migrations:

$ ./manage.py migrate --fake app last_applied-migration

That will mark the migrations as applied without actually doing anything. Then you can do your remaining migrations normally.

rodrigo
  • 94,151
  • 12
  • 143
  • 190