Prisma ORM

1- Install Prisma: If you haven’t installed Prisma yet, run the following commands to install it:

npm install prisma –save-dev
npx prisma init

2- Update the prisma/schema.prisma file:

datasource db {
provider = “postgresql”
url = …


This content originally appeared on DEV Community and was authored by Shashank Trivedi

1- Install Prisma: If you haven't installed Prisma yet, run the following commands to install it:

npm install prisma --save-dev
npx prisma init

2- Update the prisma/schema.prisma file:

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

3- Set the correct DATABASE_URL in your .env file, such as:

DATABASE_URL="postgresql://user:password@localhost:5432/mydb"

4- To generate prisma modal from existing tables

npx prisma db pull


/* This command will introspect the existing database and
automatically generate models in the `prisma/schema.prisma` file
based on the structure of your tables. */

5- Once the introspection is done, you can generate Prisma Client to interact with your database.

npx prisma generate


This content originally appeared on DEV Community and was authored by Shashank Trivedi


Print Share Comment Cite Upload Translate Updates
APA

Shashank Trivedi | Sciencx (2024-10-21T11:10:30+00:00) Prisma ORM. Retrieved from https://www.scien.cx/2024/10/21/prisma-orm/

MLA
" » Prisma ORM." Shashank Trivedi | Sciencx - Monday October 21, 2024, https://www.scien.cx/2024/10/21/prisma-orm/
HARVARD
Shashank Trivedi | Sciencx Monday October 21, 2024 » Prisma ORM., viewed ,<https://www.scien.cx/2024/10/21/prisma-orm/>
VANCOUVER
Shashank Trivedi | Sciencx - » Prisma ORM. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/21/prisma-orm/
CHICAGO
" » Prisma ORM." Shashank Trivedi | Sciencx - Accessed . https://www.scien.cx/2024/10/21/prisma-orm/
IEEE
" » Prisma ORM." Shashank Trivedi | Sciencx [Online]. Available: https://www.scien.cx/2024/10/21/prisma-orm/. [Accessed: ]
rf:citation
» Prisma ORM | Shashank Trivedi | Sciencx | https://www.scien.cx/2024/10/21/prisma-orm/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.