I have an Django 2.1 / Python 3.6 application running on Heroku's hobby account. The first version of this deployment went smoothly. Now I needed to add more fields to existing models and also add additional models from my local setup (which is running very smoothly with the changes) to Heroku. I do the usual

git push heroku master

to get the new code over to Heroku. Then I do both

heroku run python manage.py makemigrations
heroku run python manage.py migrate

The first step gives me

Running python manage.py makemigrations on ⬢ hirt-family-v4... up, run.3753 (Free)
Migrations for 'users':
- Create model XtraPhotos
- Add field phone_number to person
- Add field parent to xtraphotos

which is fine, but the migrate is also coming back with the message

Running python manage.py migrate on ⬢ hirt-family-v4... up, run.5929 (Free)

Operations to perform:

Apply all migrations: account, admin, auth, contenttypes, sessions, sites, users

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.

I tried to go step by step, meaning I add each missing field one after the other, but this also leads to the essentially same problem.

1 Answers

Alasdair On

Don't use heroku run to create the migration files.

  1. Run python manage.py makemigrations locally
  2. Check-in the new migration files
  3. Push changes to git
  4. Now, you can migrate your database with heroku run python manage.py migrate