Wednesday, November 30, 2016

makemigrations generates new migration when nothing has changed

Any idea why makemigrations would fail to recognise that a migration has already been generated?

makemigrations.py is a script which calls makemigrations with appropriate django settings. If I run this once, it will generate the initial migration, but every time I run it subsequently, it will regenerate a migration even though nothing has changed in the model. This is with django 1.10.3 and postgres. The field sk that is constantly regenerated is a foreign key relation to an unmanaged database, but I have referred to this in a different app with no bother.

I am using django 1.10.3.

I found a post in this group that had a similar issue with instantiating a class in the model that was missing an implementation for __eq__ but that doesn't apply in this case as I don't instantiate any class in the model file.

Is there any common mistake that leads to this outcome?

------------------

user@testenv:~/eit/testproj$ ./makemigrations.py 
Migrations for 'sk':
  testproj/sk/migrations/0001_initial.py:
    - Create model SKM
user@testenv:~/eit/testproj$ ./makemigrations.py 
Migrations for 'sk':
  testproj/sk/migrations/0002_auto_20161130_1643.py:
    - Alter field s on skm
user@testenv:~/eit/testproj$ 
user@testenv:~/eit/testproj$ ./makemigrations.py 
Migrations for 'sk':
  testproj/sk/migrations/0003_auto_20161130_1643.py:
    - Alter field s on skm


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ad7c5eb6-4542-456e-8e53-675c02e897b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment