我已经做了:
python manage.py schemamigration TestDBapp1 --initial
python manage.py schemamigration TestDBapp1 --auto
成功地。
但如果我输入:python manage.py migrate TestDBapp1
我明白了:sqlite3.OperationalError: table "TestDBapp1_xyz" already exists
可能是什么问题呢?
我已经做了:
python manage.py schemamigration TestDBapp1 --initial
python manage.py schemamigration TestDBapp1 --auto
成功地。
但如果我输入:python manage.py migrate TestDBapp1
我明白了:sqlite3.OperationalError: table "TestDBapp1_xyz" already exists
可能是什么问题呢?
我怀疑您已经执行syncdb
了创建表的操作。migrate
South 试图在数据库抱怨期间再次创建它们。
为避免这种情况,您必须告诉 South “伪造”初始迁移。
python manage.py migrate TestDBapp1 --fake
顾名思义,这假装迁移。请注意,这是一个一次性步骤。South 将处理您的未来syncdb
,migrate
而无需--fake
.