Search code examples
pythondjangodjango-1.7django-migrations

Django 1.7 - makemigrations not detecting changes


As the title says, I can't seem to get migrations working.

The app was originally under 1.6, so I understand that migrations won't be there initially, and indeed if I run python manage.py migrate I get:

Operations to perform:
  Synchronize unmigrated apps: myapp
  Apply all migrations: admin, contenttypes, auth, sessions
Synchronizing apps without migrations:
  Creating tables...
  Installing custom SQL...
  Installing indexes...
Running migrations:
  No migrations to apply.

If I make a change to any models in myapp, it still says unmigrated, as expected.

But if I run python manage.py makemigrations myapp I get:

No changes detected in app 'myapp'

Doesn't seem to matter what or how I run the command, it's never detecting the app as having changes, nor is it adding any migration files to the app.

Is there any way to force an app onto migrations and essentially say "This is my base to work with" or anything? Or am I missing something?

My database is a PostgreSQL one if that helps at all.


Solution

  • Ok, looks like I missed an obvious step, but posting this in case anyone else does the same.

    When upgrading to 1.7, my models became unmanaged (managed = False) - I had them as True before but seems it got reverted.

    Removing that line (To default to True) and then running makemigrations immediately made a migration module and now it's working. makemigrations will not work on unmanaged tables (Which is obvious in hindsight)