Django South错误恢复:没有这样的索引

时间:2013-06-27 03:39:51

标签: django

错误消息粘贴在下面。我有3个问题:

  1. []是什么意思?它是南方SQL命令的特殊分隔符吗?

  2. 我应该遵循南方指示来恢复吗?我之所以这么问,是因为我在其他一些情况下确实遵循了南方恢复指令,并且多次搞砸了。

  3. 帮助我理解为什么会发生错误。我在此迁移中所做的只是将一对一字段更改为普通字段

  4. 错误:

    comp_app:0039_auto__chg_field_competition_banner_img__del_unique_competition_banner_
    FATAL ERROR - The following SQL query failed: DROP INDEX "comp_app_competition_d79c66e3"
    The error was: no such index: comp_app_competition_d79c66e3
     ! Error found during real run of migration! Aborting.
    
     ! Since you have a database that does not support running
     ! schema-altering statements in transactions, we have had 
     ! to leave it in an interim state between migrations.
    
    ! You *might* be able to recover with:   = CREATE INDEX "comp_app_competition_d79c66e3" ON "comp_app_competition" ("banner_img_id"); []
       = CREATE UNIQUE INDEX "comp_app_competition_banner_img_id" ON "comp_app_competition"("banner_img_id"); []
    
     ! The South developers regret this has happened, and would
     ! like to gently persuade you to consider a slightly
     ! easier-to-deal-with DBMS (one that supports DDL transactions)
     ! NOTE: The error which caused the migration to fail is further up.
    Error in migration: comp_app:0039_auto__chg_field_competition_banner_img__del_unique_competition_banner_
    DatabaseError: no such index: comp_app_competition_d79c66e3
    

1 个答案:

答案 0 :(得分:4)

事实证明,SQLite首先不会为一对一字段创建索引,但South认为它确实存在。我怀疑数据库类型是我在使用South时遇到的许多其他错误的罪魁祸首。

解决方案很简单。我进入迁移文件并删除前向和后向函数中的索引部分。就是这样。