我正在尝试迁移数据库,但每次尝试时都会返回以下错误。我的应用程序名称是'helloservice',但该表是数据库'pulse'中的'customer'。我怎么告诉Django不要使用helloservice前缀?如果需要,我会按照教程here,现在尝试根据自己的需要调整结果。
django.db.utils.ProgrammingError: (1146, "Table 'pulse.helloservice_customer' doesn't exist")
答案 0 :(得分:0)
使用Meta类并设置表名。然后表名只设置客户。它不使用前缀(应用程序名称)。然后进行迁移并设置迁移。
class Customer(models.Model):
customer_email = models.EmailField()
password = models.CharField(max_length=20)
ccustomer_first_name = models.CharField(max_length=30)
customer_last_name = models.CharField(max_length=30)
class Meta:
db_table = "customer"