Yeah, that makes a little more sense, and that actually brings up something else that I have used Prisma before when it was integrated with the KpopStack from Netlify, and it uses Supabase and Prisma as like an ORM layer to use JavaScript to interact with the database. And then I was going through the jokes tutorial on the Remix site and it uses, I believe, SQLite as the database, and it was very seamless for me to just write my JavaScript code that went to both databases and it worked, and it was the same exact code, which was just kind of crazy.
Yeah, yeah, we've seen people even at Prisma develop an application with one database and then decide way after the fact, you know what maybe I want to use SQL instead of Postgres or something like MySQL, and they'll just switch the flag in their schema and it just works. So it's nice for experimenting.
Yeah, that is mind-boggling too that it can just flip those. And is there anything that it doesn't work with, I guess? Well, yeah, there's always going to be, there's always going to be some database specific, like data types or maybe specific functions that they have within each database that we support through specific attributes in Prisma that may not work when you switch the flag. However, the Prisma VS Code extension is going to point that out and not allow you to generate Prisma until you fix those things.
Okay. So that kind of answers a little bit of another question I have at like, what problems does Prisma solve, but are there other benefits to Prisma or anything else that like stands out to you as like developer experience or something that is really a good feature and a reason to use Prisma? Yeah, absolutely. I think, I mean, as the website says, and as pretty much any speaker about Prisma will say, the type safety that it offers is like first class. There's a lot of ORMs out there that do offer type safety, but they don't offer it to the degree that we do. Usually the ORMs will have like a class that represents each model in your database. And when you query the database, you get a representation of that class back. However, with Prisma, the types are generated based off of the actual query you run. So, you know, for a fact, the type is going to be modeled off of exactly what you got back from the database. So that's a huge help. And until you actually use it in an application, that may be a little bit confusing. But once you actually get this going in a larger application, it's ridiculously helpful.
I think that is true. Like type safety is nice to have. And when it's integrated and done for you and done in a really good way, I think that's great. I've had issues with TypeScript before where like your types don't automatically generate. And so if you can have type safety out of the box, and I think that's amazing. So do I need to know databases well to get into full stack development then to get back to kind of your talk and like what that was about? Yeah, I would say you don't. I think a good understanding of what a database does and how to interact manually with the underlying database is a good thing. But I think especially when you're just getting started, it's not necessary at all if you're using something like Prisma. You can build your queries using just the language that you're already learning, JavaScript. And then if you want to dig in and see what's going on under the hood, there's logging where you can actually spit out the queries and see what it's doing. So you could tweak those into raw queries if you really need to. So it might almost even help you learn the database language where you could write your language that you already know, JavaScript, and then spit out those queries and see what it's writing.
Comments