SlideShare uma empresa Scribd logo
1 de 47
Baixar para ler offline
Luca Del Puppo - Senior Software Engineer
Prisma the ORM that node was waiting for
Luca Del Puppo
Senior Software Engineer
Javascript Enthusiastic
Typescript Lover
“Youtuber”
“Writer”
Love sport: running, hiking
Love animals
Agenda
. What is it?
. CLI
. Data Modeling
. Generation
. Client
. Migration
. Deploy
. Conclusion
What is it?
Prisma is an open source next-generation ORM.
(Node eco-system)
Prisma Client
Auto-generated and type-safe query builder for Node.js & TypeScript
Prisma Migrate
Migration system
Prisma Studio
GUI to view and edit data in your database
Control
Productivity
Orm
Plain SQL
SQL Builder
Prisma
Healty Constraint
Providers
PostgreSQL
MySQL
SQLite
Microsoft SQL Server
MongoDB
CockroachDB
Hey Bro!
Could you talk about
interesting stu ?
Image by on
catalyststu Freepik
CLI
Install CLI
Create Project
Prisma File
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
1
2
3
4
5
6
7
8
CLI commands
init
generate
migrate
Data Modelling
Schema
One le (schema.prisma)
Data sources
Generators
Data model de nition
Syntax - PSL (Prisma Schema Language)
N.B. Multiple Files is not supported yet
Generator & DataSource
generator client {
provider = "prisma-client-js"
}
1
2
3
4
datasource db {
5
provider = "postgresql"
6
url = env("DATABASE_URL")
7
}
8
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
1
provider = "prisma-client-js"
2
}
3
4
5
6
7
8
Models
model Ingredient {
1
id Int @id @default(autoincrement())
2
name String
3
createdAt DateTime @default(now())
4
updatedAt DateTime @updatedAt
5
pizzaIngredients PizzaIngredient[]
6
7
@@map("INGREDIENTS")
8
}
9
id Int @id @default(autoincrement())
model Ingredient {
1
2
name String
3
createdAt DateTime @default(now())
4
updatedAt DateTime @updatedAt
5
pizzaIngredients PizzaIngredient[]
6
7
@@map("INGREDIENTS")
8
}
9
createdAt DateTime @default(now())
model Ingredient {
1
id Int @id @default(autoincrement())
2
name String
3
4
updatedAt DateTime @updatedAt
5
pizzaIngredients PizzaIngredient[]
6
7
@@map("INGREDIENTS")
8
}
9
updatedAt DateTime @updatedAt
model Ingredient {
1
id Int @id @default(autoincrement())
2
name String
3
createdAt DateTime @default(now())
4
5
pizzaIngredients PizzaIngredient[]
6
7
@@map("INGREDIENTS")
8
}
9
@@map("INGREDIENTS")
model Ingredient {
1
id Int @id @default(autoincrement())
2
name String
3
createdAt DateTime @default(now())
4
updatedAt DateTime @updatedAt
5
pizzaIngredients PizzaIngredient[]
6
7
8
}
9
model Ingredient {
id Int @id @default(autoincrement())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
pizzaIngredients PizzaIngredient[]
@@map("INGREDIENTS")
}
1
2
3
4
5
6
7
8
9
Relations
ingredientId Int
ingredient Ingredient @relation(fields: [ingredientId], references: [id])
model PizzaIngredient {
1
2
pizzaId Int
3
4
pizza Pizza @relation(fields: [pizzaId], references: [id])
5
6
@@id([pizzaId, ingredientId])
7
8
@@map("PIZZA_INGREDIENTS")
9
}
10
pizzaId Int
pizza Pizza @relation(fields: [pizzaId], references: [id])
model PizzaIngredient {
1
ingredientId Int
2
3
ingredient Ingredient @relation(fields: [ingredientId], references: [id])
4
5
6
@@id([pizzaId, ingredientId])
7
8
@@map("PIZZA_INGREDIENTS")
9
}
10
@@id([pizzaId, ingredientId])
model PizzaIngredient {
1
ingredientId Int
2
pizzaId Int
3
ingredient Ingredient @relation(fields: [ingredientId], references: [id])
4
pizza Pizza @relation(fields: [pizzaId], references: [id])
5
6
7
8
@@map("PIZZA_INGREDIENTS")
9
}
10
model PizzaIngredient {
ingredientId Int
pizzaId Int
ingredient Ingredient @relation(fields: [ingredientId], references: [id])
pizza Pizza @relation(fields: [pizzaId], references: [id])
@@id([pizzaId, ingredientId])
@@map("PIZZA_INGREDIENTS")
}
1
2
3
4
5
6
7
8
9
10
Generation
Generation
What does it generate?
Models
Convert Models to Typescript Types
Client
Query Models (type safe)
Constraint to build where clause
Constraint to build select
Constraint to build insert/update/delete with relation
Generated Type
export type Ingredient = {
id: number
name: string
createdAt: Date
updatedAt: Date
}
1
2
3
4
5
6
Client
Installation
What does it generate?
const prisma = new PrismaClient();
1
await prisma.$connect();
2
3
const pizza = await prisma.pizza.findUnique({
4
where: {
5
id: id,
6
},
7
include: {
8
pizzaIngredients: {
9
include: {
10
ingredient: true,
11
},
12
},
13
},
14
});
15
await prisma.$connect();
const prisma = new PrismaClient();
1
2
3
const pizza = await prisma.pizza.findUnique({
4
where: {
5
id: id,
6
},
7
include: {
8
pizzaIngredients: {
9
include: {
10
ingredient: true,
11
},
12
},
13
},
14
});
15
const pizza = await prisma.pizza.findUnique({
where: {
id: id,
},
include: {
pizzaIngredients: {
include: {
ingredient: true,
},
},
},
});
const prisma = new PrismaClient();
1
await prisma.$connect();
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const prisma = new PrismaClient();
await prisma.$connect();
const pizza = await prisma.pizza.findUnique({
where: {
id: id,
},
include: {
pizzaIngredients: {
include: {
ingredient: true,
},
},
},
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Image by on
catalyststu Freepik
Crud
SQLPrisma Single Multiple
Insert create createMany
Update update updateMany
Delete delete deleteMany
Select ndUnique/
ndFirst
ndMany
Insert/
Update
upsert
Image by on
catalyststu Freepik
Aggregation
Aggregate
Count
GroupBy
One for each model
Migration
Image by on
catalyststu Freepik
Prisma Schema Prisma CLI Database
1. update
2. prisma migrate dev
3. read schema
4. database schema
5. generate migration
6. update database
Migration ow
Image by on
catalyststu Freepik
Prisma Schema
Prisma CLI Database
2. prisma db pull
Introspection ow
1. Change database schema (SQL)
3. read schema
4. database schema
5. Update
Limitations
MongoDb is not supported (use prisma db push)
Switch DB Provider is not supported
Seeding
Prisma exposes us a command for seeding the db
It runs on
prisma migrate dev
prisma migrate reset
manually
It can be written in typescript, go, sql…
--skip-seed allows skipping
Deploy
N.B. Use a CI/CD ow for your deployment
Demo
Image by on
catalyststu Freepik
Conclusion
Cons
Newby
Don’t manage multiple provider concurrency
Splitting schema not implemented out-of-the-box (prisma-
aurora)
Pros
Wonderful developer experience
Type safe queries
Migrations
Custom queries
Active Community
Awesome documentation
Core team active in Github and Slack
Slides
Image by on
catalyststu Freepik
Prisma Series
Image by on
catalyststu Freepik
We are hiring
Image by on
catalyststu Freepik
Luca Del Puppo
@puppo92
Luca Del Puppo
Puppo_92
@puppo

Mais conteúdo relacionado

Mais procurados

Best Practices in Planning a Large-Scale Migration to AWS - AWS Online Tech T...
Best Practices in Planning a Large-Scale Migration to AWS - AWS Online Tech T...Best Practices in Planning a Large-Scale Migration to AWS - AWS Online Tech T...
Best Practices in Planning a Large-Scale Migration to AWS - AWS Online Tech T...Amazon Web Services
 
APIC/DataPower security
APIC/DataPower securityAPIC/DataPower security
APIC/DataPower securityShiu-Fun Poon
 
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...Serge Huber
 
Asp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity FrameworkAsp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity FrameworkShravan A
 
Api gateway in microservices
Api gateway in microservicesApi gateway in microservices
Api gateway in microservicesKunal Hire
 
Work Backwards to Your Graph Data Model & Queries with Amazon Neptune (DAT330...
Work Backwards to Your Graph Data Model & Queries with Amazon Neptune (DAT330...Work Backwards to Your Graph Data Model & Queries with Amazon Neptune (DAT330...
Work Backwards to Your Graph Data Model & Queries with Amazon Neptune (DAT330...Amazon Web Services
 
Customer segmentation and marketing automation with Apache Unomi
Customer segmentation and marketing automation with Apache UnomiCustomer segmentation and marketing automation with Apache Unomi
Customer segmentation and marketing automation with Apache UnomiMichael Ghen
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web APIhabib_786
 
Azure Overview Arc
Azure Overview ArcAzure Overview Arc
Azure Overview Arcrajramab
 
Deep dive into Microsoft Purview Data Loss Prevention
Deep dive into Microsoft Purview Data Loss PreventionDeep dive into Microsoft Purview Data Loss Prevention
Deep dive into Microsoft Purview Data Loss PreventionDrew Madelung
 
Knowledge Graphs for Supply Chain Operations.pdf
Knowledge Graphs for Supply Chain Operations.pdfKnowledge Graphs for Supply Chain Operations.pdf
Knowledge Graphs for Supply Chain Operations.pdfVaticle
 
Printing with APEX: PL/PDF
Printing with APEX: PL/PDFPrinting with APEX: PL/PDF
Printing with APEX: PL/PDFEnkitec
 
The AWS Playbook for Cloud Readiness & Large Scale Migrations
The AWS Playbook for Cloud Readiness & Large Scale MigrationsThe AWS Playbook for Cloud Readiness & Large Scale Migrations
The AWS Playbook for Cloud Readiness & Large Scale MigrationsAmazon Web Services
 
Azure Web Apps - Introduction
Azure Web Apps - IntroductionAzure Web Apps - Introduction
Azure Web Apps - IntroductionChristopher Gomez
 
Migrating Oracle Databases to AWS
Migrating Oracle Databases to AWSMigrating Oracle Databases to AWS
Migrating Oracle Databases to AWSAWS Germany
 
Azure Identity and access management
Azure   Identity and access managementAzure   Identity and access management
Azure Identity and access managementDinusha Kumarasiri
 
Elastic Cloud Enterprise @ Cisco
Elastic Cloud Enterprise @ CiscoElastic Cloud Enterprise @ Cisco
Elastic Cloud Enterprise @ CiscoElasticsearch
 
Webinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCI
Webinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCIWebinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCI
Webinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCIStorage Switzerland
 

Mais procurados (20)

Best Practices in Planning a Large-Scale Migration to AWS - AWS Online Tech T...
Best Practices in Planning a Large-Scale Migration to AWS - AWS Online Tech T...Best Practices in Planning a Large-Scale Migration to AWS - AWS Online Tech T...
Best Practices in Planning a Large-Scale Migration to AWS - AWS Online Tech T...
 
APIC/DataPower security
APIC/DataPower securityAPIC/DataPower security
APIC/DataPower security
 
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
 
Asp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity FrameworkAsp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity Framework
 
Api gateway in microservices
Api gateway in microservicesApi gateway in microservices
Api gateway in microservices
 
Work Backwards to Your Graph Data Model & Queries with Amazon Neptune (DAT330...
Work Backwards to Your Graph Data Model & Queries with Amazon Neptune (DAT330...Work Backwards to Your Graph Data Model & Queries with Amazon Neptune (DAT330...
Work Backwards to Your Graph Data Model & Queries with Amazon Neptune (DAT330...
 
Customer segmentation and marketing automation with Apache Unomi
Customer segmentation and marketing automation with Apache UnomiCustomer segmentation and marketing automation with Apache Unomi
Customer segmentation and marketing automation with Apache Unomi
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
Azure Overview Arc
Azure Overview ArcAzure Overview Arc
Azure Overview Arc
 
Deep dive into Microsoft Purview Data Loss Prevention
Deep dive into Microsoft Purview Data Loss PreventionDeep dive into Microsoft Purview Data Loss Prevention
Deep dive into Microsoft Purview Data Loss Prevention
 
Knowledge Graphs for Supply Chain Operations.pdf
Knowledge Graphs for Supply Chain Operations.pdfKnowledge Graphs for Supply Chain Operations.pdf
Knowledge Graphs for Supply Chain Operations.pdf
 
Printing with APEX: PL/PDF
Printing with APEX: PL/PDFPrinting with APEX: PL/PDF
Printing with APEX: PL/PDF
 
Azure Sentinel
Azure SentinelAzure Sentinel
Azure Sentinel
 
The AWS Playbook for Cloud Readiness & Large Scale Migrations
The AWS Playbook for Cloud Readiness & Large Scale MigrationsThe AWS Playbook for Cloud Readiness & Large Scale Migrations
The AWS Playbook for Cloud Readiness & Large Scale Migrations
 
Azure Web Apps - Introduction
Azure Web Apps - IntroductionAzure Web Apps - Introduction
Azure Web Apps - Introduction
 
Migrating Oracle Databases to AWS
Migrating Oracle Databases to AWSMigrating Oracle Databases to AWS
Migrating Oracle Databases to AWS
 
Rethinking Cloud Proxies
Rethinking Cloud ProxiesRethinking Cloud Proxies
Rethinking Cloud Proxies
 
Azure Identity and access management
Azure   Identity and access managementAzure   Identity and access management
Azure Identity and access management
 
Elastic Cloud Enterprise @ Cisco
Elastic Cloud Enterprise @ CiscoElastic Cloud Enterprise @ Cisco
Elastic Cloud Enterprise @ Cisco
 
Webinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCI
Webinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCIWebinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCI
Webinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCI
 

Semelhante a Prisma the ORM that node was waiting for

SPKonferenz 2017 - Introducing SDKs for Microsoft Graph
SPKonferenz 2017 - Introducing SDKs for Microsoft GraphSPKonferenz 2017 - Introducing SDKs for Microsoft Graph
SPKonferenz 2017 - Introducing SDKs for Microsoft GraphDragan Panjkov
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...DataLeader.io
 
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!Sébastien Levert
 
APIs, APIs Everywhere!
APIs, APIs Everywhere!APIs, APIs Everywhere!
APIs, APIs Everywhere!BIWUG
 
SharePoint Saturday Chicago - Everything your need to know about the Microsof...
SharePoint Saturday Chicago - Everything your need to know about the Microsof...SharePoint Saturday Chicago - Everything your need to know about the Microsof...
SharePoint Saturday Chicago - Everything your need to know about the Microsof...Sébastien Levert
 
Making Things Work Together
Making Things Work TogetherMaking Things Work Together
Making Things Work TogetherSubbu Allamaraju
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!Sébastien Levert
 
Forge - DevCon 2016: Introduction to Forge 3D Print API Through Sample Applic...
Forge - DevCon 2016: Introduction to Forge 3D Print API Through Sample Applic...Forge - DevCon 2016: Introduction to Forge 3D Print API Through Sample Applic...
Forge - DevCon 2016: Introduction to Forge 3D Print API Through Sample Applic...Autodesk
 
SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...Sébastien Levert
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3masahiroookubo
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB
 
Silverlight 5 whats new overview
Silverlight 5 whats new overviewSilverlight 5 whats new overview
Silverlight 5 whats new overviewmdc11
 
SharePoint 2010 Client Object Model
SharePoint 2010 Client Object ModelSharePoint 2010 Client Object Model
SharePoint 2010 Client Object ModelG. Scott Singleton
 
Frontend APIs powering fast paced product iterations
Frontend APIs powering fast paced product iterationsFrontend APIs powering fast paced product iterations
Frontend APIs powering fast paced product iterationsKarthik Ramgopal
 
Apache Pinot Meetup Sept02, 2020
Apache Pinot Meetup Sept02, 2020Apache Pinot Meetup Sept02, 2020
Apache Pinot Meetup Sept02, 2020Mayank Shrivastava
 
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaEvolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaMongoDB
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Tech Community
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Tech Community
 

Semelhante a Prisma the ORM that node was waiting for (20)

SPKonferenz 2017 - Introducing SDKs for Microsoft Graph
SPKonferenz 2017 - Introducing SDKs for Microsoft GraphSPKonferenz 2017 - Introducing SDKs for Microsoft Graph
SPKonferenz 2017 - Introducing SDKs for Microsoft Graph
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
 
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
 
APIs, APIs Everywhere!
APIs, APIs Everywhere!APIs, APIs Everywhere!
APIs, APIs Everywhere!
 
SharePoint Saturday Chicago - Everything your need to know about the Microsof...
SharePoint Saturday Chicago - Everything your need to know about the Microsof...SharePoint Saturday Chicago - Everything your need to know about the Microsof...
SharePoint Saturday Chicago - Everything your need to know about the Microsof...
 
Making Things Work Together
Making Things Work TogetherMaking Things Work Together
Making Things Work Together
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
 
Forge - DevCon 2016: Introduction to Forge 3D Print API Through Sample Applic...
Forge - DevCon 2016: Introduction to Forge 3D Print API Through Sample Applic...Forge - DevCon 2016: Introduction to Forge 3D Print API Through Sample Applic...
Forge - DevCon 2016: Introduction to Forge 3D Print API Through Sample Applic...
 
SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
 
ql.io at NodePDX
ql.io at NodePDXql.io at NodePDX
ql.io at NodePDX
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDB
 
Silverlight 5 whats new overview
Silverlight 5 whats new overviewSilverlight 5 whats new overview
Silverlight 5 whats new overview
 
SharePoint 2010 Client Object Model
SharePoint 2010 Client Object ModelSharePoint 2010 Client Object Model
SharePoint 2010 Client Object Model
 
Frontend APIs powering fast paced product iterations
Frontend APIs powering fast paced product iterationsFrontend APIs powering fast paced product iterations
Frontend APIs powering fast paced product iterations
 
Soap Toolkit Dcphp
Soap Toolkit DcphpSoap Toolkit Dcphp
Soap Toolkit Dcphp
 
Apache Pinot Meetup Sept02, 2020
Apache Pinot Meetup Sept02, 2020Apache Pinot Meetup Sept02, 2020
Apache Pinot Meetup Sept02, 2020
 
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaEvolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needs
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needs
 

Mais de Commit University

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Breaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdf
Breaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdfBreaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdf
Breaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdfCommit University
 
Accelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdf
Accelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdfAccelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdf
Accelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdfCommit University
 
Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...
Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...
Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...Commit University
 
Commit - Qwik il framework che ti stupirà.pptx
Commit - Qwik il framework che ti stupirà.pptxCommit - Qwik il framework che ti stupirà.pptx
Commit - Qwik il framework che ti stupirà.pptxCommit University
 
Sviluppare da zero una Angular Web App per la PA
Sviluppare da zero una Angular Web App per la PASviluppare da zero una Angular Web App per la PA
Sviluppare da zero una Angular Web App per la PACommit University
 
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...Commit University
 
Decision-making for Software Development Teams - Commit University
Decision-making for Software Development Teams - Commit UniversityDecision-making for Software Development Teams - Commit University
Decision-making for Software Development Teams - Commit UniversityCommit University
 
Component Design Pattern nei Game Engine.pdf
Component Design Pattern nei Game Engine.pdfComponent Design Pattern nei Game Engine.pdf
Component Design Pattern nei Game Engine.pdfCommit University
 
Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...
Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...
Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...Commit University
 
Prototipazione Low-Code con AWS Step Functions
Prototipazione Low-Code con AWS Step FunctionsPrototipazione Low-Code con AWS Step Functions
Prototipazione Low-Code con AWS Step FunctionsCommit University
 
KMM survival guide: how to tackle struggles between Kotlin and Swift
KMM survival guide: how to tackle struggles between Kotlin and SwiftKMM survival guide: how to tackle struggles between Kotlin and Swift
KMM survival guide: how to tackle struggles between Kotlin and SwiftCommit University
 
Da Vuex a Pinia: come fare la migrazione
Da Vuex a Pinia: come fare la migrazioneDa Vuex a Pinia: come fare la migrazione
Da Vuex a Pinia: come fare la migrazioneCommit University
 
Orchestrare Micro-frontend con micro-lc
Orchestrare Micro-frontend con micro-lcOrchestrare Micro-frontend con micro-lc
Orchestrare Micro-frontend con micro-lcCommit University
 
Fastify has defeated Lagacy-Code
Fastify has defeated Lagacy-CodeFastify has defeated Lagacy-Code
Fastify has defeated Lagacy-CodeCommit University
 
Alpine.js: the outsider Javascript framework
Alpine.js: the outsider Javascript frameworkAlpine.js: the outsider Javascript framework
Alpine.js: the outsider Javascript frameworkCommit University
 

Mais de Commit University (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Breaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdf
Breaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdfBreaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdf
Breaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdf
 
Accelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdf
Accelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdfAccelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdf
Accelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdf
 
Slide-10years.pdf
Slide-10years.pdfSlide-10years.pdf
Slide-10years.pdf
 
Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...
Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...
Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...
 
Vue.js slots.pdf
Vue.js slots.pdfVue.js slots.pdf
Vue.js slots.pdf
 
Commit - Qwik il framework che ti stupirà.pptx
Commit - Qwik il framework che ti stupirà.pptxCommit - Qwik il framework che ti stupirà.pptx
Commit - Qwik il framework che ti stupirà.pptx
 
Sviluppare da zero una Angular Web App per la PA
Sviluppare da zero una Angular Web App per la PASviluppare da zero una Angular Web App per la PA
Sviluppare da zero una Angular Web App per la PA
 
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
 
Decision-making for Software Development Teams - Commit University
Decision-making for Software Development Teams - Commit UniversityDecision-making for Software Development Teams - Commit University
Decision-making for Software Development Teams - Commit University
 
Component Design Pattern nei Game Engine.pdf
Component Design Pattern nei Game Engine.pdfComponent Design Pattern nei Game Engine.pdf
Component Design Pattern nei Game Engine.pdf
 
Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...
Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...
Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...
 
Prototipazione Low-Code con AWS Step Functions
Prototipazione Low-Code con AWS Step FunctionsPrototipazione Low-Code con AWS Step Functions
Prototipazione Low-Code con AWS Step Functions
 
KMM survival guide: how to tackle struggles between Kotlin and Swift
KMM survival guide: how to tackle struggles between Kotlin and SwiftKMM survival guide: how to tackle struggles between Kotlin and Swift
KMM survival guide: how to tackle struggles between Kotlin and Swift
 
Da Vuex a Pinia: come fare la migrazione
Da Vuex a Pinia: come fare la migrazioneDa Vuex a Pinia: come fare la migrazione
Da Vuex a Pinia: come fare la migrazione
 
Orchestrare Micro-frontend con micro-lc
Orchestrare Micro-frontend con micro-lcOrchestrare Micro-frontend con micro-lc
Orchestrare Micro-frontend con micro-lc
 
Fastify has defeated Lagacy-Code
Fastify has defeated Lagacy-CodeFastify has defeated Lagacy-Code
Fastify has defeated Lagacy-Code
 
SwiftUI vs UIKit
SwiftUI vs UIKitSwiftUI vs UIKit
SwiftUI vs UIKit
 
Alpine.js: the outsider Javascript framework
Alpine.js: the outsider Javascript frameworkAlpine.js: the outsider Javascript framework
Alpine.js: the outsider Javascript framework
 

Último

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Prisma the ORM that node was waiting for

  • 1. Luca Del Puppo - Senior Software Engineer Prisma the ORM that node was waiting for
  • 2. Luca Del Puppo Senior Software Engineer Javascript Enthusiastic Typescript Lover “Youtuber” “Writer” Love sport: running, hiking Love animals
  • 3. Agenda . What is it? . CLI . Data Modeling . Generation . Client . Migration . Deploy . Conclusion
  • 5. Prisma is an open source next-generation ORM. (Node eco-system)
  • 6. Prisma Client Auto-generated and type-safe query builder for Node.js & TypeScript
  • 8. Prisma Studio GUI to view and edit data in your database
  • 11. Hey Bro! Could you talk about interesting stu ? Image by on catalyststu Freepik
  • 12. CLI
  • 15. Prisma File generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } 1 2 3 4 5 6 7 8
  • 18. Schema One le (schema.prisma) Data sources Generators Data model de nition Syntax - PSL (Prisma Schema Language) N.B. Multiple Files is not supported yet
  • 19. Generator & DataSource generator client { provider = "prisma-client-js" } 1 2 3 4 datasource db { 5 provider = "postgresql" 6 url = env("DATABASE_URL") 7 } 8 datasource db { provider = "postgresql" url = env("DATABASE_URL") } generator client { 1 provider = "prisma-client-js" 2 } 3 4 5 6 7 8
  • 20. Models model Ingredient { 1 id Int @id @default(autoincrement()) 2 name String 3 createdAt DateTime @default(now()) 4 updatedAt DateTime @updatedAt 5 pizzaIngredients PizzaIngredient[] 6 7 @@map("INGREDIENTS") 8 } 9 id Int @id @default(autoincrement()) model Ingredient { 1 2 name String 3 createdAt DateTime @default(now()) 4 updatedAt DateTime @updatedAt 5 pizzaIngredients PizzaIngredient[] 6 7 @@map("INGREDIENTS") 8 } 9 createdAt DateTime @default(now()) model Ingredient { 1 id Int @id @default(autoincrement()) 2 name String 3 4 updatedAt DateTime @updatedAt 5 pizzaIngredients PizzaIngredient[] 6 7 @@map("INGREDIENTS") 8 } 9 updatedAt DateTime @updatedAt model Ingredient { 1 id Int @id @default(autoincrement()) 2 name String 3 createdAt DateTime @default(now()) 4 5 pizzaIngredients PizzaIngredient[] 6 7 @@map("INGREDIENTS") 8 } 9 @@map("INGREDIENTS") model Ingredient { 1 id Int @id @default(autoincrement()) 2 name String 3 createdAt DateTime @default(now()) 4 updatedAt DateTime @updatedAt 5 pizzaIngredients PizzaIngredient[] 6 7 8 } 9 model Ingredient { id Int @id @default(autoincrement()) name String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt pizzaIngredients PizzaIngredient[] @@map("INGREDIENTS") } 1 2 3 4 5 6 7 8 9
  • 21. Relations ingredientId Int ingredient Ingredient @relation(fields: [ingredientId], references: [id]) model PizzaIngredient { 1 2 pizzaId Int 3 4 pizza Pizza @relation(fields: [pizzaId], references: [id]) 5 6 @@id([pizzaId, ingredientId]) 7 8 @@map("PIZZA_INGREDIENTS") 9 } 10 pizzaId Int pizza Pizza @relation(fields: [pizzaId], references: [id]) model PizzaIngredient { 1 ingredientId Int 2 3 ingredient Ingredient @relation(fields: [ingredientId], references: [id]) 4 5 6 @@id([pizzaId, ingredientId]) 7 8 @@map("PIZZA_INGREDIENTS") 9 } 10 @@id([pizzaId, ingredientId]) model PizzaIngredient { 1 ingredientId Int 2 pizzaId Int 3 ingredient Ingredient @relation(fields: [ingredientId], references: [id]) 4 pizza Pizza @relation(fields: [pizzaId], references: [id]) 5 6 7 8 @@map("PIZZA_INGREDIENTS") 9 } 10 model PizzaIngredient { ingredientId Int pizzaId Int ingredient Ingredient @relation(fields: [ingredientId], references: [id]) pizza Pizza @relation(fields: [pizzaId], references: [id]) @@id([pizzaId, ingredientId]) @@map("PIZZA_INGREDIENTS") } 1 2 3 4 5 6 7 8 9 10
  • 24.
  • 25. What does it generate? Models Convert Models to Typescript Types Client Query Models (type safe) Constraint to build where clause Constraint to build select Constraint to build insert/update/delete with relation
  • 26. Generated Type export type Ingredient = { id: number name: string createdAt: Date updatedAt: Date } 1 2 3 4 5 6
  • 29. What does it generate? const prisma = new PrismaClient(); 1 await prisma.$connect(); 2 3 const pizza = await prisma.pizza.findUnique({ 4 where: { 5 id: id, 6 }, 7 include: { 8 pizzaIngredients: { 9 include: { 10 ingredient: true, 11 }, 12 }, 13 }, 14 }); 15 await prisma.$connect(); const prisma = new PrismaClient(); 1 2 3 const pizza = await prisma.pizza.findUnique({ 4 where: { 5 id: id, 6 }, 7 include: { 8 pizzaIngredients: { 9 include: { 10 ingredient: true, 11 }, 12 }, 13 }, 14 }); 15 const pizza = await prisma.pizza.findUnique({ where: { id: id, }, include: { pizzaIngredients: { include: { ingredient: true, }, }, }, }); const prisma = new PrismaClient(); 1 await prisma.$connect(); 2 3 4 5 6 7 8 9 10 11 12 13 14 15 const prisma = new PrismaClient(); await prisma.$connect(); const pizza = await prisma.pizza.findUnique({ where: { id: id, }, include: { pizzaIngredients: { include: { ingredient: true, }, }, }, }); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  • 30. Image by on catalyststu Freepik Crud SQLPrisma Single Multiple Insert create createMany Update update updateMany Delete delete deleteMany Select ndUnique/ ndFirst ndMany Insert/ Update upsert
  • 31. Image by on catalyststu Freepik Aggregation Aggregate Count GroupBy
  • 32. One for each model
  • 34. Image by on catalyststu Freepik Prisma Schema Prisma CLI Database 1. update 2. prisma migrate dev 3. read schema 4. database schema 5. generate migration 6. update database Migration ow
  • 35. Image by on catalyststu Freepik Prisma Schema Prisma CLI Database 2. prisma db pull Introspection ow 1. Change database schema (SQL) 3. read schema 4. database schema 5. Update
  • 36. Limitations MongoDb is not supported (use prisma db push) Switch DB Provider is not supported
  • 37. Seeding Prisma exposes us a command for seeding the db It runs on prisma migrate dev prisma migrate reset manually It can be written in typescript, go, sql… --skip-seed allows skipping
  • 39. N.B. Use a CI/CD ow for your deployment
  • 42. Cons Newby Don’t manage multiple provider concurrency Splitting schema not implemented out-of-the-box (prisma- aurora)
  • 43. Pros Wonderful developer experience Type safe queries Migrations Custom queries Active Community Awesome documentation Core team active in Github and Slack
  • 45. Prisma Series Image by on catalyststu Freepik
  • 46. We are hiring Image by on catalyststu Freepik
  • 47. Luca Del Puppo @puppo92 Luca Del Puppo Puppo_92 @puppo