Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
437 views
in Technique[技术] by (71.8m points)

Django South - table already exists

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...