From the course: Master Next.js by Building Scalable Apps with Routing, Databases, and Performance

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Setting up Prisma

Setting up Prisma

In the previous lecture, we installed the Prisma in the project. And we can check that from the package JSON also. Now the next step to configure the ORM is to set the database that we want to use. Prisma works with a lot of databases. So we need to define which one do we want to work with. So in the terminal, we use the following command, I will say npx prisma init hyphen hyphen data source hyphen provider and now the database that is SQLite. Now if you observe here, this command has created the prisma folder inside which we have the schema.prisma file. This is a quite important file. Let's see where it is used. Let me open the schema file. So this is where you define the schemas for the database. And we will add a schema as well to practically try it. But first, let's install a plugin for Prisma code, which will improve the readability of the dot Prisma files. I'll search for Prisma and install this plugin. Alright, now if I go to the schema file, and then as you can see, the code…

Contents