Woa, this is some down to the point video, time not waisted watching this. Thanks. Sabin needs a raise, this is so much better then I remember how other guy did it.
Thank you for concise presentation! One clarification, though - it seems that one-to-many relationships is a bit wrong - `@unique` annotation for `userId` in `Post` model would actually preclude single user from having multiple posts, so this annotation probably needs to be removed.
In 1:31, are you sure this is one-to-many? You put @unique for userId in Post. This means that in Post table only one row with certain userID can exist, which implies that for specific user only one post can exist.
Wow, what a tremendous video. Well done! I would like to have seen a video where you also explain the different prisma functions, such as findMany, findOne etc.. written in code, intertwined with the use if these different model relations. Maybe there is one, will look through the channel.
I think one-to-many had a problem, the ‘userId’ should not be unique, because more than one post can be related to the same user a.k.a. the same ‘userId’
Brother, In 1-m realtionship model the userId in Post model is @unique as 1 user can have multiple post so userId can repeat right?, so it shoudn't be unique
i cant find in prisma docs about a zero to many relationships, can somebody help me? model infonutriday { id String @id @db.VarChar(45) date DateTime @db.Date portion Float @db.Float protein Float @db.Float calories Float @db.Float grease Float @db.Float salt Float @db.Float finalizedDay Int @db.TinyInt meals Meal[] foods Food[] infonutriday_has_users infonutriday_has_users[] } model Food { id Int @id @default(autoincrement()) name String portion Int protein Float @db.Float calories Float @db.Float grease Float @db.Float salt Float @db.Float image String? infonutridayId String? infonutriday infonutriday? @relation(fields: [infonutridayId], references: [id]) meals_has_foods meals_has_foods[] users_has_foods users_has_foods[] @@map("foods") } model Meal { id Int @id @default(autoincrement()) name String isMeal Int @db.TinyInt portion Int protein Float @db.Float calories Float @db.Float grease Float @db.Float salt Float @db.Float image String? infonutridayId String? infonutriday infonutriday? @relation(fields: [infonutridayId], references: [id]) meals_has_foods meals_has_foods[] users_has_meals users_has_meals[] @@map("meals") } Infonutriday can have 0 or many foods or infonutriday can have 0 or many meals. Any suggestion ?
I was impressed by the exceptionally clear and to-the-point descriptions of the different relationships - well done!
Glad you enjoyed it!
That's what we need! A simple and concise yet complete and clear explanation and examples of a subject...
Woa, this is some down to the point video, time not waisted watching this. Thanks. Sabin needs a raise, this is so much better then I remember how other guy did it.
I appreciate your work dude. it's definitely too the point and very much time saving.
Thank you for concise presentation! One clarification, though - it seems that one-to-many relationships is a bit wrong - `@unique` annotation for `userId` in `Post` model would actually preclude single user from having multiple posts, so this annotation probably needs to be removed.
Hi, thanks for your input. Can you please point me to the document where this concept is discussed.
You are correct. the @unique attribute needs to be removed otherwise this is a one-to-one
Simple and straight forward!. Thanks
So simple and straight to the point, thanks!
In 1:31, are you sure this is one-to-many? You put @unique for userId in Post. This means that in Post table only one row with certain userID can exist, which implies that for specific user only one post can exist.
Thanks, Sabin.
Looking forward to the self-relation video
Coming soon!
These shorts are the best
Clean explanation, thanks
thank you for this , you saved my life
great video sir, keep up
VERY clear to follow along, thanks
I appreciate your effort.
Wow, what a tremendous video. Well done!
I would like to have seen a video where you also explain the different prisma functions, such as findMany, findOne etc.. written in code, intertwined with the use if these different model relations.
Maybe there is one, will look through the channel.
Straight to the point! However, diagrams would be helpful :)
Gonne be super helpful! Thanks!
thanks for the clarification, how can we have multiple prisma schema definition under the same repo/project !?
I think one-to-many had a problem, the ‘userId’ should not be unique, because more than one post can be related to the same user a.k.a. the same ‘userId’
Thanks for the video. Please, which relationship is best to create a relationship between Wishlist, user and products?
Brother, In 1-m realtionship model the userId in Post model is @unique
as 1 user can have multiple post so userId can repeat right?, so it shoudn't be unique
Does it mean that we'd better use the implicit one to keep the prisma config file clear?🤔
👋🏽
This would be dependent on your use-case. You can create an explicit m-n relation to add more fields to the join table.
Are there any performance implications of implicit m-m relationship?
Thank you man ❤
Is there something like this? With postgresql
Role {
userIds: String[]
users: User[] @relation(field: 'userIds', references: 'id')
}
good explanation
4:15 why would be good to handle the relation table by oneself?
@PrismaData, isn't it a violation of the constraints to define userId as @unqiue---00:01:23?
muito bom mano. parabéns pelo trabalho.
Thanks.
and create action, how can i do?
hey, Does anybody knows how to seperate prisma model in different files?
With the include to get the name instead of just id's you can do something like this:
include: {
tags: {
include: {
tag: true,
},
},
},
my brain already stackoverflow.
To the point 👍
greate man
I thought you were Ben awad for a sec
Please dont overlap code with your face))
good, thank you boy
i cant find in prisma docs about a zero to many relationships, can somebody help me?
model infonutriday {
id String @id @db.VarChar(45)
date DateTime @db.Date
portion Float @db.Float
protein Float @db.Float
calories Float @db.Float
grease Float @db.Float
salt Float @db.Float
finalizedDay Int @db.TinyInt
meals Meal[]
foods Food[]
infonutriday_has_users infonutriday_has_users[]
}
model Food {
id Int @id @default(autoincrement())
name String
portion Int
protein Float @db.Float
calories Float @db.Float
grease Float @db.Float
salt Float @db.Float
image String?
infonutridayId String?
infonutriday infonutriday? @relation(fields: [infonutridayId], references: [id])
meals_has_foods meals_has_foods[]
users_has_foods users_has_foods[]
@@map("foods")
}
model Meal {
id Int @id @default(autoincrement())
name String
isMeal Int @db.TinyInt
portion Int
protein Float @db.Float
calories Float @db.Float
grease Float @db.Float
salt Float @db.Float
image String?
infonutridayId String?
infonutriday infonutriday? @relation(fields: [infonutridayId], references: [id])
meals_has_foods meals_has_foods[]
users_has_meals users_has_meals[]
@@map("meals")
}
Infonutriday can have 0 or many foods or infonutriday can have 0 or many meals.
Any suggestion ?
Thanks.