django.db.utils.OperationalError:(1091,“无法删除'company_id';请检查列/键是否存在”))

时间:2019-06-12 07:28:54

标签: django django-models django-migrations django-mysql

当我迁移时,我总是会出错。首先,我创建了表格,然后将其删除。现在,当我再次创建表时。我正面临这个问题。它还不会创建列。

Model.py

class AssociateCompany(models.Model):
    user = models.ForeignKey(User, related_name="associate_user", on_delete=models.CASCADE)
    company = models.ForeignKey(Company, related_name="associate_company", on_delete=models.CASCADE)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

它不会创建user_id和company_id列,并显示以下错误:

django.db.utils.OperationalError:(1091,“无法删除'company_id';请检查列/键是否存在”))

0 个答案:

没有答案