A developer updates a Docker Compose configuration to switch from MongoDB to a PostgreSQL container. After starting the database, they connect via pgAdmin, create a new package.json for a reservation microservice, and install Prisma Client and migration tools to manage database schema and type generation.
Length 6:24
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #prisma #postgresql #docker #microservices #database #orm #typescript #refactoring #backend #development
0:00 Hey everyone. Today I want to look into adding Prisma 0:03 into our 0:04 application, which has been a very heavily requested 0:07 topic in 0:08 the course. 0:09 Now, Prisma is a very popular ORM tool to allow 0:13 us 0:13 to interact with a database, similar to how we're utilizing 0:17 Mongoose right now for MongoDB or TypeORM for 0:21 a SQL based database. We can also use Prisma as our 0:25 ORM. 0:26 Now, one of the great features about Prisma 0:28 is that it's going to allow us to 0:30 actually generate the types for our code, the TypeScript for our code, based 0:34 off of the database schema we provide, which is gonna be really nice 'cause it's 0:38 gonna cut down on a lot of boilerplate code. 0:40 Now, I have a separate video that goes into depth starting with Prisma 0:44 from a fresh project. So if you'd like to learn more about Prisma 0:48 from the very beginning, you can simply check that video out. 0:52 I'll leave it in the resources below. 0:55 Otherwise, let's look and see how we can plug Prisma into our 0:57 existing 0:59 application and swap it out for our existing MongoDB 1:03 database. First thing we're gonna do is actually run a 1:06 Postgres server in our Docker Compose. 1:09 So we're gonna be utilizing Postgres as our database of choice that 1:13 Prisma is going to connect to. 1:16 So let's open up our Docker Compose and scroll 1:19 down to our existing Mongo image. So this is the container we're 1:23 running for our database right now. 1:26 Let's swap this out for a new Postgres image instead. 1:30 So for the image, we'll specify Postgres, 1:34 and then we'll provide ports here. 1:36 So we're gonna expose the Postgres ports. 1:39 The default Postgres port is five four three two. 1:42 Let's map to our machines five four three two as well. 1:45 And this is so we can still connect to our database locally using a
The rest of the transcript is for members.
Sign in