learn prisma js
A
amir·10 mar, 2023·6 min read
All Articles

Prisma JS

hello everyone, recently I wanted migrate my back-end ORM (TypeORM) to primas js, but was dificult, why?...
because I was just learning
My back-end It is made in Nest js + TypeORM, the idea is learn for me

How Migrate?

Install Prisma
Terminal
npm install prisma --save-dev

Terminal
npm install @prisma/client --save

For create folder prisma run the next command, after a few seconds you can see in the folder.
Terminal
npx prisma init

In your folder root you can see in the folder prisma, inside create folder migrations and file seed.ts




Schema.prisma

automatically inside this file required enviroment DATABASE_URL , add in your .env.
default prisma look .env in your directory root

Packakge.json

add the next line in your package.json and run
PLAIN
"prisma:pull": "prisma db pull"
in case of your enviroment file be in another path
PLAIN
"prisma:pull": "dotenv -e ./environment/.env.development -- prisma db pull",
what does this line do?
this linea do introspect your database and create or update your prisma.schema file.
Terminal
npm run prisma:pull
the result in my case is this.



2.4k

Discussion

3 comments

Share your thoughts...

Este sitio utiliza cookies para mejorar tu experiencia. Al continuar navegando, aceptas su uso. Puedes deshabilitarlas desde tu navegador.