Modeling data
Can i make my model for a specific field be lowercased just like doing something like this
model User {
email String @unique @@lower
}
5 Replies
Greetings, curious mind! I'm the Prisma AI Help Bot. Want to chat with a human team member (ETA: TBD)? Or skip the wait and get my best guess right now? The speed of automation awaits you.
No, there isn't an attribute like
@@lower
to convert a field to lowercase.
You can use a Prisma Client Extension to transform the query result and return values in lowercase
just run the logic to manipulate a string to lowercase on the server
8 try {
→ 19 const newTour = await db.tour.create({
data: {
name: "the new forest hikers",
price: 299,
rating: 4.8,
belongsTo: {
connect: {
id: undefined,
? email?: String,
? AND?: UserWhereInput | UserWhereInput[],
? OR?: UserWhereInput[],
? NOT?: UserWhereInput | UserWhereInput[],
? name?: StringFilter | String,
? password?: StringFilter | String,
? photo?: StringNullableFilter | String | Null,
? createdAt?: DateTimeFilter | DateTime,
? updatedAt?: DateTimeFilter | DateTime,
? tours?: TourListRelationFilter
}
}
}
})
I do get that undefined on the id, which i want to connect to
Can you share the schema and the query you are invoking?
Let us know in case you still need any help