nikolasburk
generator client {
provider = "prisma-client-js"
previewFeatures = ["nativeTypes"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
name String? @db.VarChar(255)
}
model Post {
id Int @id @default(autoincrement())
title String @db.VarChar(100)
createdAt DateTime @db.Timestamp(6)
wordCount Int @db.SmallInt
}
You can enable native types in your Prisma schema using the nativeTypes
feature flag.
🆕 New scalar types in the Prisma schema: BigInt
, Bytes
and Decimal
(Preview)
We're also adding new scalar types to the Prisma schema! From today on, you can use BigInt
, Bytes
and Decimal
. Check out the release notes to see how these are mapped to your database and to JavaScript/TypeScript when querying with Prisma Client JS.
You can enable those with the nativeTypes
feature flag in your Prisma schema as well.
🏸 Set foreign keys directly (Preview)
This new Preview feature has been long requested and we're excited to make it finally happen. It'll make your code less verbose when you're working with relations. You now don't need to use a nested write with connect
or disconnect
any more to "rewire" a relation of two records, but instead you can just "set the foreign key" directly:
await prisma.post.create({
data: {
// You can now set the foreign key directly...
authorId: 1,
// ... or connect the relationship...
// author: {
// connect: {
// id: 1
// }
// }
// ... but not both at the same time
},
});
You can enable those with the uncheckedScalarInputs
feature flag in your Prisma schema as well.
🍾 More exiting features
Thanks to your feedback, we were able to promote the $transaction
and connectOrCreate
APIs from Preview to this stable release! 🎉 This means you don't need to include the respective feature flag in your Prisma schema any more to use them. If you're curious about the remaining improvements in this release, be sure to check out the release notes.
🤩 Prisma Migrate is in Early Access
We're making great progress with Prisma Migrate and were able to open up an Early Access program. You can learn everything you need to know in order to try out Prisma Migrate here. If you're just curious about the new workflows, check out this quick recorded from our VP of Product @Hervé - Product at Prisma. Share your thoughts about the new version of Prisma Migrate in the #product-feedback channel 🙌
🌟 Help us spread the word about Prisma 🌟
To help spread the word about Prisma, we’d very much appreciate if you would star the repo 🌟 And if you’re excited about the features in this week’s release, then help us and share your excitement on Twitter.
📰 Join our What's new in Prisma livestream on Thursday
Catch @ryan and me on Youtube as we are are discussing the latest news from the Prisma ecosystem and community in the next! 🎉
👀 Make your online talk recordings more accessible with subtitles
We'd love to help you make your talk recordings (no matter if Meetup or conference talk) more accessible by adding subtitles to it for free! Reach out to sponsorships@prisma.io if you are interested in getting subtitles for your videos!