Hey Kyle, great vid. One note though: In around 29:00 you create an index on email, but you already have the unique constraint, which will create an index for you (unique constraints are basically an index with extra functionality). So all that sorting or filtering will already use the index, and you just add duplicate second index on the same field.
Yeah prisma's pretty cool Quick hot take - migrations kinda suck and `npx prisma db push` w/ a db branch model (like planetscale) is a way better dx IMO
Do you have any videos or can you recommend any docs regarding this? I'm kinda stuck on the whole migration thing. Dev migrations work great, but translating those changes to prod seems to be really unclear to me. Running deploy from vercel tells me that there's no changes and the error log says I should baseline. Ultimately I ended up changing my connection on my local machine to the prod database and resolving all of the migrations, but didn't seem like the correct way to do it.
i forgot where but i managed to create some scripts that have the migration and pushing set @@curiouslycory "prismaPush": "dotenv -e .env.local npx prisma db push ", "prismaMigrate": "dotenv -e .env.local npx prisma migrate ", "prismaStudio": "dotenv -e .env.local npx prisma studio" these are my scripts in my package.json file ( for npm run and i installed "dotenv": "^16.3.1", "dotenv-cli": "^7.3.0", one year too late but i feel your pain
This couldn’t have been a better timing. There is a new stack called t3-stack which uses nextjs, typescript, tailwind and tRPC. I WOULD LOVE you to create a video on tRPC because it simplifies and removes a shit ton of backend code. It also removes the schema so no graphQL because typescript safely infers the types so all you need to do is call the backend function and you’re good to go
Literally the reason I'm here and quite surpirsed this is the most upvoted comment lol, I just started playing around with it today and it is amazing! There's some new syntax in v10 which means most videos are outdated but it's not that different, would love a video from Kyle
@@moodyhamoudi Good question, I have blog page on my website and I'm storing the likes and views for each of the blog in a DB and displaying the same on the blog page. Additionally I've self hosted a web analytics tool - Umami where I'll also need a DB. I hope this answers you're question:)
I don't often leave comments but this video (and many others) was extremely helpful and to the point. This is the perfect way to learn something like Prisma and I'm tremendously grateful to you. There's so many people putting out content like this but you're one of the best. You make everything super approachable and have a knack for going in depth without being overwhelming. You've got a gift, keep on doing your thing man!
as i undertsand if you got for example one-to-many realtion you can connect models from both sides?You can make user and connect certain post or you can make post and connect your user?
Hey Kyle! Thanks for the Great video. Just a recommendation: for nodejs tutorials, you can put the VS code terminal on the right side instead of bottom, so both code and output is clearly visible. Keep up the amazing work
Thanks to your video I was able to create a complex database when I have never written an SQL line in my life. Thank you so much for this video, Prisma is amazing!
Did anyone else notice that when he logged the generated raw queries by Prisma , no join was taking place between the related tables , rather, instead of the join , it generated two back to back select queries between the related tables which means Prsima must be joining them through it's query engine as opposed to delegating the joins to the database engine in the application layer, this could have serious performance ramifications.
In the model relationship that you pointed out between User & Post - for the favoritedBy section. Wouldn't that be a many to many relationship? A Post could be favorited by Multiple Users couldn't it? 🤔
Nice and thorough tutorial. The others ones kinda jumped in fast or implemented prisma into prebuilt projects. I've never seen it before, so it's nice to get a rundown on how everything works with configuration :)
Other alternatives to switching around the one-to-one relationship is a) when deleting, delete the dependent (preference) table first then the main table b) in the dependent table (preference) on the relationship put a cascade delete. In this case only need to delete the user table and it will auto delete related entry in the preference table.
as i undertsand if you got for example one-to-many realtion you can connect models from both sides?You can make user and connect certain post or you can make post and connect your user?
Kyle youre brilliant man. I love learning from you, you give great practical tips, and details! One of the best developers on youtube. Thank you Kyle!!!
I loved this tutorial, one thing I didn't understand is why you reconfigured the user preferences so they'd delete. Does Prisma not have a modifier for cascading?
Nice video! I've never seen someone else research the prisma schema language that thoroughly! It's incredibly telling that it takes an entire hour to fully teach all of it, but that's why we're (me and a friend) are making a _*GUI for writing Prisma Schemas* (in development). I wonder if anyone else would benefit from that. This is mostly useful for larger projects, where a normal prisma schema could be 300+ lines long Please do leave any thoughts in the comments
Amazing course as always. Following you was the best decision I made a while back :) .. By the way, can't we get a copy of your course summary? It will really help as review notes :)
in vscode: command shift p -> Then select Typescript restart TS server. That will fix if the types don't refresh. You must be in a TS file or tsconfig to see this command appear.
Great work thanks. Came here looking for some more in-depth/practical cases around using the prisma migrate tool. It'd be interesting to see a tutorial talking exclusively on handling migrations considering multiple environments [local,stage,production]. Keep up the great work!
when i saw this kid a while back I thought damn .... he is good, but then I thought that he will not continue and will go away... here we are 1.51 million subs later..
Hey Kyle, thanks for your awesome work! Really love your videos. I suggest that you do a video covering GraphQL/Apollo just like this one, it would be great!
Awesome video, this is what was looking for 💕💘 I have a request, can you make a video on GUN JS DB like this. It is amazing free pear-to-pear DB and people will love it.
I cannot thank you enough for this ❤ , there are folks creating a whole 10 hour course and cover exactly this much content. You are a GEM creating compact, filled and useful videos in practicle sense. Super thanks from India!
Wow, this video was freaing incredible! I was looking for an introduction to the most used ORMs around and you provided an mind-blowing deep-dive. But I have a few things to criticize: 1. When you tried to delete the user and userPreferences: It would have been way better to use the resp. delete function for the preferences first. As same as you would do when "cleaning" the DB usually. 2. The way of presentation: Don't get me wrong, your voice and the way everything is shown is perfectly fine. But you should consider talking a bit slower and also don't move around so much. It feels pretty hectic as if you're in a rush watching you live during the presentation. Slow down and chill a bit, we do not run away :) Anyway, overall 20 / 10 rating. Thanks for your amazing work!
Top quality tutorial! Really detailed and "simplified". I am not usually writing this kind of messages, a like is usually enough. But I want to express my gratitude. Thank you! 😃
Such a great tutorial! I have a quetion, haven`t find anything on the documentation: how can I insert a PDF file into a db using prisma? I mean, I know that I must use Bytes type, but how exactly does it works?
@33:20 or so, on a mac, in vscode, cmd+shift+p, then click "developer reload window" fixes it (refreshes it as well) Ive also had instances where I reserve to fix.
Kyle, you are awesome! Thank you for all the videos you provide for us. Does anyone know where Kyle's notes are for this video? I looked on Github and couldn't find them. Thanks....