Django South - 表已经存在 [英] Django South - table already exists
问题描述
syncdb
, schemamigration --initial
)。 然后,我更新了 models.py
添加一个字段并运行 ./ manage.py schemamigration myapp - 自动
。似乎找到了这个字段,并说我可以用 ./ manage.py migrate myapp
应用这个字段。但是,这样做会出错:
django.db.utils.DatabaseError:表myapp_tablename已经存在
tablename
是 models.py
。
我正在运行Django 1.2,South 0.7
由于您已经在数据库中创建了表,您只需要运行初始迁移作为假的
./ manage.py migrate myapp --fake
确保模式模型与数据库中表格的模式相同。
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
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.
这篇关于Django South - 表已经存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!