database - django.db.utils.ProgrammingError 尽管删除了有问题的代码
问题描述
即使我从我的 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
解决方案
推荐阅读
- python - 带有 Google Cloud Compute 启动脚本的 ImportError
- json - 为什么我不能从中制作一个键控流
- node.js - 从附件获取图像作为 Arraybuffer 后如何使用 Axios 将图像作为文件发布
- c# - WPF C#捕获具有半透明背景的画布图像
- c++ - Qt 串行通信
- android - 错误:无法解决:com.android.support.constraint:constraintlayout:1.1.3 在项目结构对话框中显示受影响的模块:app
- postgresql - 如何优化 PostgreSQL 中时间戳的连接
- reactjs - 在 react-hooks textInput 中自动添加字符
- python - 时间为零的signal.setitimer,后跟signal.pause不起作用
- python - python Flask API AttributeError AttributeError:'_thread._local'对象没有属性'value'