首页 文章

使用django南方的外键迁移

提问于
浏览
1

我更改了外键的引用而没有更改字段的名称,现在我对同一字段指向不同的表有2个约束 . 我的模型是这样的

class Activity(models.Model):
    ...
    source = models.ForeignKey(FSObject)

并成为

class Activity(models.Model):
    ...
    source = models.ForeignKey(FreezedRef)

现在我在运行测试时收到此消息:

IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`test_tcf_api`.`storage_activity`, CONSTRAINT `source_id_refs_id_fc96b4b044ceb88` FOREIGN KEY (`source_id`) REFERENCES `storage_fsobject` (`id`))')

我应该如何删除这个旧的引用,显然,南跳过了它 .

2 回答

  • -1

    您是否在同一次迁移中更新了其他内容?他们工作还是休息?我只是问,因为我在运行迁移时从未让South破解任何东西 - 如果出现问题,通常会在该过程中引发异常 .

  • 0

相关问题