title: Django South: detecting if fake migrations were applied in production
body: <p>I'm adding South to an existing application which has many installations however I don't have access to production environments due to security reasons.<br/>We can only supply Python installation script that will be run by persons that often don't have any knowledge about Django, South, etc.</p>
  
  <p>I'm aware of the fact that for existing installations any future upgrade will have to start with executing:</p>
  
  <pre><code>manage.py syncdb
  manage.py migrate --all 0001 --fake
  </code></pre>
  
  <p>and any new installations will start with:</p>
  
  <pre><code>manage.py syncdb
  manage.py migrate -all
  </code></pre>
  
  <p><br/>
  Is there any way to detect if south initial migrations were already applied (e.g. by detecting if south_migfationhistory table exists) in a database agnostic way (perhaps with Django itself) ?<br/>What I would like to do is:</p>
  
  <pre><code>(pseudocode)
  db = database.connect(dbname, user, password)
  if db.table_existst('south_migrationhistory'):
    execute 'manage.py syncdb'
    execute 'manage.py migrate --all'
  else:
    execute 'manage.py syncdb'
    execute 'manage.py migrate --all 0001 --fake'
    execute 'manage.py migrate --all'
  </code></pre>