Search code examples
djangodjango-modelsmodels

Django: When to run makemigrations?


In addition to adding/deleting/modifying field to model, Django also detects changes when I add or modify methods to the model.

So my question is should I run makemigrations every time I change or add a new method in models ?


Solution

  • When you add/change model methods, then you don't need to run ./manage makemigrations and ./manage.py migrate.

    But whenever you edit your model fields (adding a new one, changing an existing one or altering any of the arguments it takes) then you should always run migrations.