LEGION
LEGION
PPrisma
Created by LEGION on 4/6/2024 in #help-and-questions
Prisma new field adding will thorw the unkown error
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String @unique
hashedPassword String
username String @unique
image String
termsAccepted Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
isVerified Boolean @default(false)
verifyOTP String @default("")
resetOTP String @default("")
role Role @default(USER)
invoices Invoices[]
userPlans UserPlans @relation(fields: [userPlansId], references: [id])
userPlansId String @db.ObjectId
userIPv6Plans IPv6Plans[]
}

model UserPlans {
id String @id @default(auto()) @map("_id") @db.ObjectId
// customer plan fields
residential Boolean @default(false)
datacenter_shared Boolean @default(false)
datacenter_unmetered Boolean @default(false)
ipv6 Boolean @default(false)
mobile_proxies Boolean @default(false)
User User[]
}
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String @unique
hashedPassword String
username String @unique
image String
termsAccepted Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
isVerified Boolean @default(false)
verifyOTP String @default("")
resetOTP String @default("")
role Role @default(USER)
invoices Invoices[]
userPlans UserPlans @relation(fields: [userPlansId], references: [id])
userPlansId String @db.ObjectId
userIPv6Plans IPv6Plans[]
}

model UserPlans {
id String @id @default(auto()) @map("_id") @db.ObjectId
// customer plan fields
residential Boolean @default(false)
datacenter_shared Boolean @default(false)
datacenter_unmetered Boolean @default(false)
ipv6 Boolean @default(false)
mobile_proxies Boolean @default(false)
User User[]
}
i have this prisma schema and my situation is i want userPlans to be unique to all users and i want to return default values if userPlans dont exists for old users and i dont want to excute any js
26 replies