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.
We can only supply Python installation script that will be run by persons that often don’t have any knowledge about Django, South, etc.
I’m aware of the fact that for existing installations any future upgrade will have to start with executing:
manage.py syncdb
manage.py migrate --all 0001 --fake
and any new installations will start with:
manage.py syncdb
manage.py migrate -all
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) ?
What I would like to do is:
(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'
For future reference this is how I ended up doing this: