Skip to content
Advertisement

Prisma problem inserting into autogenerated int ID field: integer out of range for type int4

This is strange because the id column is an Int and should be default autoincrementing. The error message complains about int4. If I look in the database the only int4 column is the id field.

Advertisement

Answer

It seems your users are too active, if there is more than 2.147.483.647 comment ids, the Int id has reach it max value

You can convert it to BigInt like:

id BigInt @id @default(autoincrement())

But the best is maybe to use uuid like:

id String @id @unique @default(uuid())

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement