title: Django 1.8 and how to change migration order for apps
body: <p>In Django 1.8 using Postgres, how do I change the migration order? I have the following....</p>
  
  <pre><code>AUTH_USER_MODEL = 'users.User'
  INSTALLED_APPS = [
      "test.apps.users",
      'django_nose',
      'django_coverage',
      'oauth2_provider',
      'rest_framework',
      'django_extensions',
  ]
  </code></pre>
  
  <p>and no matter what order my apps are in <code>oauth2_provider</code> gives me the error...</p>
  
  <blockquote>
    <p><strong>django.db.utils.ProgrammingError: relation "users_user" does not exist</strong> </p>
  </blockquote>
  
  <pre><code>Operations to perform:
    Synchronize unmigrated apps: oauth2_provider, staticfiles, messages, django_extensions, django_coverage, django_nose, rest_framework, common
    Apply all migrations: users, sessions, admin, auth, contenttypes
  Synchronizing apps without migrations:
    Creating tables...
      Creating table oauth2_provider_application
      Creating table oauth2_provider_grant
      Creating table oauth2_provider_accesstoken
      Creating table oauth2_provider_refreshtoken
      Running deferred SQL...
  </code></pre>
  
  <p>because its applying its own migrations before the apps.users table has been created.</p>
  
  <p>If I removed <code>oauth2_provider</code>, apply migrations, then add back in <code>oauth2_provider</code> then apply migrations again, it works! However, there must be a way to force <code>test.apps.users</code> migrations to be created before <code>oauth2_provider</code> or anything else.</p>
  
  <p>What I noticed is that inside <code>oauth2_provider</code> they have:</p>
  
  <blockquote>
    <p>migrations.swappable_dependency(settings.AUTH_USER_MODEL)
    <a href="https://github.com/evonove/django-oauth-toolkit/blob/master/oauth2_provider/migrations/0001_initial.py#L14" rel="nofollow">https://github.com/evonove/django-oauth-toolkit/blob/master/oauth2_provider/migrations/0001_initial.py#L14</a></p>
  </blockquote>
  
  <p>However, Django just ignores this and try's to apply the migration for <code>oauth2_provider</code> before my user model giving the error above error when ever I run tests and need to create a new test database.   </p>