Prisma Orm Datatype

Anu MauAnu Mau
1 min read

There are two part of PRISMA ORM

  1. PRISMA CLI “Prisma CLI Generate a Prisma Client for database access”

  2. PRISMA CLINET “USE TO ACCESS THE DATABASE READ AND WRITE"

INSTALLATION

npm install prisma

npm install @prisma/client

npx prisma init --datasource-provider mysql

# go to prisma/schema.prisma > remove  output in client output   = "../generated/prisma" 
# because it genrate cline in specific directory. 
# to genrate in defalut remove it default directory is node_modules/@prisma/client 
# and node_modules/.prisma/client

npx prisma genrate

GO TO PRISMA/SCHEMA.PRISMA > START WIRTING SCHEMA HERE.

AFTER THIS RUN

npx prisma migrate dev —name=”migration_name”

migration workflow

  1. generate migration.sql

  2. update database

  3. generate prisma client to use in project

USE PRISMA IN EXISTING DATABASE

USE CUSTOM MODEL AND FIELD NAME

CHANGES CONTINUE USING THIS COMMAND

WORKFLOW OF PRISMA

DATA TYPE IN PRISMA

PERMISSIONS

USE EXTERNAL DRIVER

0
Subscribe to my newsletter

Read articles from Anu Mau directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anu Mau
Anu Mau