Hi everybody,
I have this model:
class Usuarios(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
website = models.URLField(max_length=200, blank=True, default="")
.
.
.
.
I did makemigrations and migrate but then I wanted to use UUID instead id, so I changed the model to this:
class Usuarios(models.Model):
id = models.UUIDField(primary_key = True,default = uuid.uuid4, editable = False)
user = models.OneToOneField(User, on_delete=models.CASCADE)
website = models.URLField(max_length=200, blank=True, default="")
.
.
.
.
But I get the next error:
django.db.utils.ProgrammingError: column "id" is of type bigint but expression is of type uuid
LINE 1: ...uineo", "picture", "created", "modified") VALUES ('1c99de28-...
^
HINT: You will need to rewrite or cast the expression.
I delete migrations and did again makemigrations and migrate, but I have the same error.
Someone who knows why this happens or I have to delete my database even though I have information that I do not want to delete?