How to manage django missing migration files of 3rd party apps?
Asked Answered
D

1

6

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?

Domeniga answered 21/5, 2015 at 19:2 Comment(5)
I know one method but I am not sure whether it's appropriate for your situation. Can you explain me why you need to makemigrations after django update? Is not that new migration already in django folder? Or you mean makemigrations for your apps?Wickner
This is very good question why there is no mogrations...Domeniga
After migrate I have: ` Running migrations: No migrations to apply. Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.` After makemigrations following migrations are created: Migrations for 'account': 0002_auto_20150521_2330.py: - Alter field email on emailaddress So... migration files are missed after update... really strange for me.Domeniga
Is not it related to django-allauth?. Post here that new migration if it's just one new.Wickner
@Wickner you are right, this is 3rd party app django-allauth: python manage.py sqlmigrate account 0002 BEGIN; ALTER TABLE "account_emailaddress" ALTER COLUMN "email" TYPE varchar(254); COMMIT; Should I run sql in my database? Or what is other best solution?Domeniga
D
12

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

Domeniga answered 25/5, 2015 at 22:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.