Search code examples
djangodatabase-migrationheroku-postgresdjango-1.7django-migrations

Django 1.7 makemigrations not having an effect


I keep running python manage.py makemigrations on my heroku server, but no matter how many times I run it I get:

$heroku run python manage.py makemigrations
Running `python manage.py makemigrations` attached to terminal... up, run.2680
Migrations for 'default':
  0002_auto_20141120_2007.py:
    - Alter field user on usersocialauth

and if I run heroku run python manage.py migrate

it comes back with:

Running `python manage.py migrate` attached to terminal... up, run.1285
Operations to perform:
  Synchronize unmigrated apps: baflist_core, rest_framework, localflavor, storages
  Apply all migrations: admin, userAccount, contenttypes, sessions, default, location, messaging, forum, auth, posts
Synchronizing apps without migrations:
  Creating tables...
  Installing custom SQL...
  Installing indexes...
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.

Admittedly, I only know enough about postgres and migrations to be dangerous, so I figured I'd ask on here. Has anyone run into this before?


Solution

  • After local migration completed you should have migration file(s) on <your django app>/migrations folder Ex (restapi is mine django application here):

    /Django/app/folder/restapi/migrations$ ls
    0001_initial.py  0001_initial.pyc  __init__.py  __init__.pyc
    

    So you should commit migrations file manually:

    heroku$ git commit restapi/migrations/0001_initial.py -m "migrations file"
    heroku$ git push heroku master
    

    Note: NO heroku will not run migrate on you app automatically! I have checked this! You should run migrate for your app after you push the file:

    heroku$ heroku run python manage.py migrate restapi Running python manage.py migrate restapi attached to terminal... up, run.4602 Operations to perform: Apply all migrations: restapi Running migrations: Applying restapi.0001_initial... OK