3

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

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

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

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

错误:

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
4

1 回答 1

4

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

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

于 2013-07-03T16:21:47.990 回答