我不断收到以下错误,即使我从我的models。py文件中删除了有问题的代码。当我尝试将主键设置为UUID字段时,第一次出现了这个问题。从那时起,我一直得到如下所示的错误。删除数据库并重新运行迁移仍然会出现错误。
这是我的models。py文件
class VolunteerInstance(models.Model):
student_id = models.CharField(
blank = True,
editable = True,
default = 'No Student ID Provided',
max_length = 255
)
grad_year = models.CharField(
blank = True,
max_length = 255,
default = 'No Graduation Year Provided',
editable = True
)
organization = models.CharField(
blank = False,
max_length = 255
)
description = models.TextField(
blank = False,
)
supervisor_Name = models.CharField(
blank = False,
max_length = 255
)
supervisor_Phone_Number = models.CharField(
blank = True,
null = True,
max_length = 10
)
volunteering_Date = models.DateField()
volunteering_Duration = models.FloatField()
scanned_Form = models.FileField(
null = True,
blank = True,
upload_to = 'scanned_files'
)
approved = models.BooleanField(
default = False,
blank = True,
)
这是我一直收到的错误。
File "C:\Program Files\Python38\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.CannotCoerce: cannot cast type bigint to uuid
LINE 1: ...unteerinstance" ALTER COLUMN "id" TYPE uuid USING "id"::uuid