我正在从配置文件模型设置更改为扩展用户模型。我正在尝试根据本指南设置我的南迁移。我有一些其他模型引用了 User 模型,因此当我自动生成我的模式迁移时,我得到了以下几行:
db.alter_column(u'app_model', 'user',
self.gf('django.db.models.fields.related.ForeignKey')(to=orm['app.user']))
问题是,当我尝试迁移时,这些迁移会导致 South 崩溃:
FATAL ERROR - The following SQL query failed: INSERT INTO "_south_new_app_model" () SELECT FROM "app_model";
The error was: near ")": syntax error
! 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:
! 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: app:0018_auto__chg_field_model_user.py
DatabaseError: near ")": syntax error
注意:这是使用./manage.py schemamigration app --auto
. 我没有编辑它。
问题是,我在乎吗?数据库中存储的引用类型相同,我已经完成了重命名表的步骤。alter_table
如果我从迁移中删除这些行,一切似乎都会继续工作。这是一个可怕的、可怕的想法,还是可以?