I have a problem with migrations on heroku. I have just upgraded version of django from 1.8.1 to 1.8.2 in my project on heroku, because of some missing migrations:
https://github.com/django/django/blob/1.8/django/contrib/auth/migrations/0005_alter_user_last_login_null.py#L14-L18
After this upgrade, on my local project I was forced to do standard procedure: python manage.py makemigrations python manage.py migrate
Of course this new, generated migrations are outside of my git repository. If I will run heroku run this will generate new migrations in new dyno, so without any impact on my current slug.
What is the best solution for this situation? How to generate migrations or add missing migrations of django or 3rd part libs when e.g. you are doing upgrade of the libs? What is the best working strategy?
Django keeps track of applied migrations in the Django migrations table. Django migrations consist of plain Python files containing a Migration class. Django knows which changes to perform from the operations list in the Migration classes. Django compares your models to a project state it builds from the migrations.
Deleting migration files means losing your history. This historical info is recorded in the django_migrations table in your database. if you delete migration files, you will get dependency errors. So Don't try to lose your history by deleting your migration files.
Answer is quiet trivial, could be useful for others. To use MIGRATION_MODULES is the correct answer.
https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-MIGRATION_MODULES
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With