apps/blog/content/blog/whats-new-in-prisma-q2-2021-z70muetl386d/index.mdx
Learn about everything that has happened in the Prisma ecosystem and community from April to June 2021.
Our engineers have been hard at work issuing new releases with many improvements and new features every two weeks. Here is an overview of the most exciting features that we have launched in the last three months.
You can stay up-to-date about all upcoming features on our roadmap.
Prisma's online data browser allows you to easily collaborate with your team on your data. You can:
Note: The online data browser is released in Early Access. This means it is not production-ready and we are actively seeking feedback that helps us improve it. Please report any UX issues, bugs or other friction points that you encounter.
You can try it today and we would love to know your feedback!
Try Prisma's Online Data Browser
Since 2.26.0, we introduced a new feature in Preview which allow you to define cascading delete and update behavior in your Prisma schema. Here’s an example:
model User {
id String @id
posts Post[]
}
model Post {
id String @id
authorId String
author User @relation(fields: [authorId], onDelete: Cascade, onUpdate: Cascade)
}
If you run into any questions or have any feedback, we’re available in this issue.
prisma db push is now generally available 🚀prisma db push enables you to update the database schema from the Prisma schema file, without generating any migrations.
This is especially useful when prototyping a new feature, iterating on the schema changes before creating migrations or generally if you are at stage of your development process, where you don't need to persist the schema change history via database migrations.
It is now promoted from Preview to General Availability. You can find more info on prisma db push in the official docs.
prisma migrate devSince 2.25.0, Database schema drift occurs when your database schema is out of sync with your migration history, i.e. the database schema has drifted away from the source of truth.
With this release, we improve the way how the drift is printed to the console when detected in the prisma migrate dev command.
While this is thew only command that uses this notation in today's release, we plan to use it in other places where it would be useful for debugging in the future.
[*] Changed the `Color` enum
[+] Added variant `TRANSPARENT`
[-] Removed variant `RED`
[*] Changed the `Cat` table
[-] Removed column `color`
[+] Added column `vaccinated`
[*] Changed the `Dog` table
[-] Dropped the primary key on columns (id)
[-] Removed column `name`
[+] Added column `weight`
[*] Altered column `isGoodDog` (arity changed from Nullable to Required, default changed from `None` to `Some(Value(Boolean(true)))`)
[+] Added unique index on columns (weight)
We regularly add new features to the Prisma Client API to enable more powerful database queries that were previously only possible via plain SQL and the $queryRaw escape hatch.
You can now use a .env file with Prisma Client Go. This makes it easier to keep database credentials outside your Prisma schema and potentially work with multiple clients at the same time:
example/
├── .env
├── main.go
└── schema.prisma
Learn more about using the .env file in our documentation.
In 2.24.0, we added Json and enum support to the MongoDB provider for Prisma Client. Here's a sample schema with both:
prisma
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["mongodb"]
}
model Log {
id String @id @default(dbgenerated()) @map("_id")
message String
level Level @default(Info)
meta Json
}
enum Level {
Info
Warn
Error
}
As a reminder, the mongodb provider is still in Early Access. If you'd like to use MongoDB with Prisma, please fill out this 2-minute Typeform and we'll get you an invite to our Getting Started guide and private Slack channel right away!
Since 2.23.0, you can now filter rows by data inside a Json type. JSON filtering support is available in PostgreSQL and MySQL.
Assuming we have the following data in a database:
| id | level | message | meta |
|---|---|---|---|
| 2 | INFO | application listening on port 3000 | {"host": "bob"} |
| 3 | INFO | upgrading account | {"host": "alice", "request_id": 10} |
| 4 | INFO | charging customer | {"host": "alice", "amount": 20, "request_id": 10} |
| 5 | ERROR | credit card expired | {"host": "alice", "amount": 20, "request_id": 10} |
| 6 | INFO | signing up | {"host": "bob", "request_id": 1} |
| 7 | INFO | application listening on port 3000 | {"host": "alice"} |
| 8 | INFO | signed up | {"host": "bob", "email": "[email protected]", "request_id": 1} |
We can now filter logs by the data inside the meta field.
const logs = await prisma.log.findMany({
where: {
meta: {
// path looks for the request_id key inside meta
path: ['request_id'],
// and we select rows whose request_id is 10
equals: 10,
},
},
orderBy: {
id: 'asc',
},
})
generator client {
provider = "prisma-client-js"
previewFeatures = ["filterJson"]
}
model Log {
id Int @id @default(autoincrement())
level Level
message String
meta Json
}
enum Level {
INFO
WARN
ERROR
}
Since 2.21.0, you can Order by an aggregate in groupBy. Let's say you want to group your users by the city they live in and then order the results by the cities with the most users.
const userRatingsCount = await prisma.user.groupBy({
by: ['city'],
count: {
city: true,
},
orderBy: {
_count: {
city: 'desc',
},
},
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
city String
}
The query returns the following data:
[
{ city: 'Berlin', count: { city: 3 } },
{ city: 'Paris', count: { city: 2 } },
{ city: 'Amsterdam', count: { city: 1 } },
]
We wouldn't be where we are today without our amazing community of developers. Our Slack has more than 40k members and is a great place to ask questions, share feedback and initiate discussions all around Prisma.
<Meetup title="Connect Dev Africa Meetup #1" meetupLink="https://www.meetup.com/connect-dev-africa/events/278245682/" youtubeLink="https://youtu.be/7Hs2D8V0uvk" talks={[ { title: 'Personal Branding for Software Engineers', author: 'Gift Egwuenu', }, { title: 'Building large sites on the Jamstack with On-demand builders (ODB)', author: 'Ekene Eze', }, { title:'The Beginner’s Guide to GraphQL', author:'Mahmoud Abdelwahab' } ]} imagePath="/blog/meetups/meetup-connect-dev-africa.png" /> <Meetup title="TypeScript Berlin Meetup #6" meetupLink="https://www.meetup.com/TypeScript-Berlin/events/278178824/" youtubeLink="https://www.youtube.com/watch?v=biAsioxl2Vc" talks={[ { title: 'End-to-end typesafe APIs with tRPC', author: 'Alexander Johansson', }, { title: 'Introduction to Shelter', author: 'David Barrat', }, ]} imagePath="/blog/meetups/meetup-typescript.png" /> <Meetup title="Prisma Meetup #5 + a raffle!" meetupLink="https://www.meetup.com/Berlin-Prisma-Meetup/events/277753565/" youtubeLink="https://www.youtube.com/watch?v=svmOmnNL9h8" talks={[ { title: 'Dungeons & Dragons themed introduction to graph databases', author: 'Guy Royse', }, { title: "Prisma's Developer Experience", author: 'Julieta Curdi', }, { title:'Building a World-class Multi-region Application', author:'Andy Woods & Adam Storm' } ]} imagePath="/blog/meetups/meetup-prisma.png" /> <Meetup title="TypeScript Berlin/Sevilla Meetup" meetupLink="https://www.meetup.com/TypeScript-Berlin/events/277610945/" youtubeLink="https://www.youtube.com/watch?v=RH49aarW6sU" talks={[ { title: 'Understanding Variance in the Typescript Type System', author: 'Tițian Cericova-Dragomir', }, { title: 'PropTypes vs TypeScript', author: 'Dillion Megida', }, { title:'Elm, a delightful language for learning functional programming', author:'Kajetan Świątek' } ]} imagePath="/blog/meetups/meetup-typescript.png" /> <Meetup title="GraphQL Berlin Meetup #22" meetupLink="https://www.meetup.com/graphql-berlin/events/277280108/" youtubeLink="https://www.youtube.com/watch?v=1QHBjeJW5xg" talks={[ { title: 'The Case For Lighter GraphQL Client Libraries', author: 'Matheus Cardoso', }, { title: 'Introduction to urql', author: 'Phil Plückthun', }, { title: 'Scaling GraphQL at Zalando', author: 'Aditya Pratap Singh & Mariano Carballal', }, ]} imagePath="/blog/meetups/meetup-graphql.png" /> <Meetup title="Prisma Meetup #4" meetupLink="https://www.meetup.com/Berlin-Prisma-Meetup/events/277236269/" youtubeLink="https://www.youtube.com/watch?v=2g525rJdYFU" imagePath="/blog/meetups/meetup-prisma.png" talks={[ { title: 'Prisma at Iopool', author: 'Luc Matagne', }, { title: 'Launching the Prisma Data Platform', author: 'Spiros Martzoukos', }, ]} />
</MeetupList>Prisma Day has been a huge success and we want to thank everyone who attended and helped making it a great experience! It was a two day event of talks and workshops by members of the Prisma community.
This was our 3rd Prisma day which had 15 amazing talks and an introduction to Prisma workshop offered in 11 different languages.
We've been excited to see fantastic speakers, educators sharing their knowledge and what they're working on. We would also love to thank the amazing workshop hosts for delivering exceptional workshops.
The event covered a broad range of topics:
If you missed the event, you can watch all the talks on our YouTube channel.
To celebrate Earth Day 🌍, we started the Tweets for trees initiative. This was an initiative where we planted a tree for every tweet about Prisma during the month of April. We planted a total of 269 trees 🌳 for our Prisma forrest.
We love seeing laptops that are decorated with Prisma stickers, so we're shipping sticker packs for free to our community members! In this quarter, we've sent out over 300 sticker packs to developers that are excited about Prisma!
Every other Thursday, Nikolas Burk and Ryan Chenkie discuss the latest Prisma release and other news from the Prisma ecosystem and community. If you want to travel back in time and learn about a past release, you can find all the shows from this quarter here:
<Youtube videoId="i8TqB5ofVaM" />This bring us to a total of 6 livestreams and 5 new videos 🎉. You can check them out on our YouTube channel
During this quarter, we published several technical articles that you might find useful:
We also published multiple success stories of companies adopting Prisma:
This quarter, several Prisma folks have appeared on external channels and livestreams. Here's an overview of all of them:
Here are the awesome new Prismates who joined Prisma this quarter:
<Employee name="Pierre-Antoine Mills" title="TypeScript Engineer" imgURL="/blog/whats-new-in-prisma-q2-2021-z70muetl386d/imgs/18401805.png" joinDate="April 2021" funFact="I'm a dark hole when it comes to good food. Friends know that delicious food may just disappear 🍰 🌀" whyPrisma="Prisma is awesome, disruptive, and a game-changer. It has been setting the bar very high around DX, which has led an awesome, and ever growing community — I find this super exciting. Prisma is also a great playground for us TypeScript developers. It's full of opportunities and challenges, but also a unique place where I can express some of my deep TypeScript knowledge. So here we are, let's type!" socialGithub="https://github.com/millsp" socialTwitter="https://twitter.com/millsp_" />
<Employee name="Jacob Drabczyk" title="Software Engineer" imgURL="/blog/whats-new-in-prisma-q2-2021-z70muetl386d/imgs/71383.png" joinDate="April 2021" funFact="I once travelled across Canada by train, and can’t wait to do it again." whyPrisma="I joined Prisma because I believe in open source software. I also think type safe languages are the future. Especially Rust, which is a joy to work with. With that in mind, applying what I’ve learned over the years to a product like Prisma feels impactful, and a way to give back to the community." socialGithub="https://github.com/br0kend" />
<Employee name="Frank Prößdorf" title="Software Engineer" imgURL="/blog/whats-new-in-prisma-q2-2021-z70muetl386d/imgs/21019.png" joinDate="May 2021" funFact="I've tried to read War and Peace three times and could never make it beyond half the book🙈" whyPrisma=" It's a really interesting product with a lot of potential. It's exciting to work with so many talented and nice people." socialLinkedIn="https://www.linkedin.com/in/frank-pr%C3%B6%C3%9Fdorf-87453724/" socialGithub="https://github.com/endor" />
<Employee name="Sarah Vang Nøer" title="Engineering Manager" imgURL="/blog/whats-new-in-prisma-q2-2021-z70muetl386d/imgs/1601494710722.png" joinDate="June 2021" funFact="I once did the voice of a sexy, talking painting." whyPrisma="Prisma has an amazing people culture, and I really wanted to not just be part of it but strengthen it even further in order to empower a culture of growth, diversity, and excellent engineering practices. It's exciting to be able to have so much influence on how we take a great team and product even further" socialLinkedIn="https://www.linkedin.com/in/sarah-vang-n%C3%B8hr-868b8857/" />
Also, we are hiring for various roles! If you're interested in joining us and becoming a Prismate, check out our jobs page.
The best places to stay up-to-date about what we are currently working on are GitHub issues and our public roadmap. (Mongo DB support coming soon 👀)
You can also engage in conversations in our Slack channel, start a discussion on GitHub or join one of the many Prisma meetups around the world.