title: Django migrate schema from sqlite to postgresql
body: <p>I am developing a large django-based project. On my laptop I use SQLite3 as a database. I have created a lot of migrations for my models. Everything seems working.</p>
  
  <p>Then I want to use PostgreSQL on the production server. I have prepared an empty database and trying to do <code>manage.py syncdb</code>. And suddenly I get an error due to not existing relation.</p>
  
  <pre><code>Operations to perform:
    Synchronize unmigrated apps: suit, messages, humanize, imagekit, staticfiles, crispy_forms, storages, django_extensions, localflavor, registration
    Apply all migrations: [here list of my apps], sites, user_auth, sessions, auth
  Synchronizing apps without migrations:
    Creating tables...
      Creating table registration_registrationprofile
      Running deferred SQL...
  Traceback (most recent call last):
    File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 62, in execute
      return self.cursor.execute(sql)
  psycopg2.ProgrammingError: relation "user_auth_account" does not exist
  </code></pre>
  
  <p>Trying to drop my sqlite database and perform <code>syncdb</code> with the new sqlite: it creates the schema without issues.</p>
  
  <p>Here I've realized that SQLite does not use Foreign Key relations and simply uses <code>integer</code> types for all references. So it works for sqlite. Very smart, Django. But all my models are depending of each other. And I want to use different databases.</p>
  
  <p>Now I have a bunch of migrations working on SQLite only.</p>
  
  <p>I understand that it is possible to run migrations one-by-one for each application where the model first gets created. But it would be a hell.</p>
  
  <p>Is it possible to detect dependencies and run these migrations in correct order?</p>