net-tech-
net-tech-
Explore posts from servers
PPrisma
Created by net-tech- on 4/27/2024 in #help-and-questions
Prisma warns of data loss when changing required field to optional, even when there is a default val
Hi there, I currently a column with this row:
autoDeleteIntroductionsOnLeave Boolean? @default(false)
autoDeleteIntroductionsOnLeave Boolean? @default(false)
and I am trying to change it to
autoDeleteIntroductionsOnLeave Boolean @default(false)
autoDeleteIntroductionsOnLeave Boolean @default(false)
however, even with the default value I get an error while trying to use db push:
@internal/database:db:push: ⚠️ We found changes that cannot be executed:
@internal/database:db:push:
@internal/database:db:push: • Made the column `autoDeleteIntroductionsOnLeave` on table `Guild` required, but there are 5 existing NULL values.
@internal/database:db:push:
@internal/database:db:push:
✔ To apply this change we need to reset the database, do you want to continue? All data will be lost. … no
@internal/database:db:push: ⚠️ We found changes that cannot be executed:
@internal/database:db:push:
@internal/database:db:push: • Made the column `autoDeleteIntroductionsOnLeave` on table `Guild` required, but there are 5 existing NULL values.
@internal/database:db:push:
@internal/database:db:push:
✔ To apply this change we need to reset the database, do you want to continue? All data will be lost. … no
is there a way for me to just tell prisma to use false, as I defined using @default, since it seems quite logical to me. --- System Information: macOS Version: 14.4.1 Chip: Apple M2 Pro Architecture: arm64 JavaScript/TypeScript Project Information: Node.js Version: v20.4.0 TypeScript Version: Version 5.4.3 @prisma/client Version: 5.11.0 prisma Version: 5.11.0
9 replies