How to know which models have changed and need make migrations?

39 views
Skip to first unread message

Neto

unread,
Apr 7, 2016, 12:19:44 PM4/7/16
to Django users
In my localhost is everything migrated, but in production have "Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them."
How to know which models have changed and need make migrations? Exist a command to know?

Daniel Roseman

unread,
Apr 7, 2016, 1:50:54 PM4/7/16
to Django users
You shouldn't ever need to make migrations in production. You make them in dev, commit to source control, deploy along with the rest of the code, then run the migrations in prod.

--
DR.

Neto

unread,
Apr 8, 2016, 12:17:16 PM4/8/16
to Django users
I know, but in production is showing the message that I have to do makemigrations.
I need a command to know what models need to makemigrations

C. Kirby

unread,
Apr 8, 2016, 12:56:07 PM4/8/16
to Django users
Are you sure you are adding your new migrations to your source control? It sounds like the model changes  are being correctly commited but the generated migrations are not.

jorr...@gmail.com

unread,
Apr 9, 2016, 9:52:27 AM4/9/16
to Django users
I've run into the problem of migration files not being added to source control with PyCharm because PyCharm doesn't seem to automatically commit auto-created files unless you explicitly tell it to in the settings (and even then it doesn't always work).

Tim Graham

unread,
Apr 9, 2016, 10:00:03 AM4/9/16
to Django users
Also, your models might reference a setting whose value differs between development and production. This probably won't cause any problems but will trip up the migrations autodetector into thinking that a migration needs to be made.

https://code.djangoproject.com/ticket/24648
Reply all
Reply to author
Forward
0 new messages