Django South - table already exists

Steve picture Steve · Jun 22, 2010 · Viewed 64.4k times · Source

I am trying to get started with South. I had an existing database and I added South (syncdb, schemamigration --initial).

Then, I updated models.py to add a field and ran ./manage.py schemamigration myapp --auto. It seemed to find the field and said I could apply this with ./manage.py migrate myapp. But, doing that gave the error:

django.db.utils.DatabaseError: table "myapp_tablename" already exists

tablename is the first table listed in models.py.

I am running Django 1.2, South 0.7

Answer

Ashok picture Ashok · Jun 22, 2010

since you already have the tables created in the database, you just need to run the initial migration as fake

./manage.py migrate myapp --fake

make sure that the schema of models is same as schema of tables in database.