【问题标题】:south django migrate南 django 迁移
【发布时间】:2011-04-03 19:03:33
【问题描述】:

我刚刚做了:

python manage.py schemamigration TestDBapp1 --initial
python manage.py schemamigration TestDBapp1 --auto

成功了。

但如果我输入:python manage.py migrate TestDBapp1

我明白了:sqlite3.OperationalError: table "TestDBapp1_xyz" already exists

可能是什么问题?

【问题讨论】:

    标签: django django-south


    【解决方案1】:

    我怀疑您已经执行了创建表的syncdb。 South 在migrate 期间尝试再次创建它们,数据库自然会抱怨。

    为避免这种情况,您必须告诉 South 初始迁移“fake”。

    python manage.py migrate TestDBapp1 --fake
    

    顾名思义,这假装迁移。请注意,这是一个一个时间步。 South 将处理您的未来 syncdb 和 migrate 而无需 --fake。

    【讨论】:

      猜你喜欢
      • 2012-06-05
      • 2014-06-22
      • 2011-09-28
      • 2014-02-21
      • 1970-01-01
      • 2014-12-21
      • 2014-07-30
      • 2015-11-03
      相关资源
      最近更新 更多