Error while changing database engine to PostgreSQL

1.1k views Asked by At

I got this error after changing the engine, the database is connected however it figured out my id field is a bigint, yet I specifically set it as a UUID field.

class Cart(models.Model):
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
created_at = models.DateTimeField(auto_now_add=True)

in terminal I get this error:

django.db.utils.ProgrammingError: cannot cast type bigint to uuid
LINE 1: ...LE "store_cart" ALTER COLUMN "id" TYPE uuid USING "id"::uuid

enter image description here

1

There are 1 answers

2
melaku shiferaw On BEST ANSWER

I was the same issues as you, And I fixed it by deleting all previous migrations tables, I hope it will work also for you.