Hey <!everyone> :v: :prisma-cool: We just release...
# prisma-whats-new
n
Hey <!everyone> ✌️ prisma cool We just released Prisma v2.16.0 prisma rainbow 🚚 The Prisma CLI moves from the 
@prisma/cli
 to the 
prisma
 npm package
Going forward, you can install the Prisma CLI via the 
prisma
 npm package:
Copy code
npm install prisma --save-dev
or
Copy code
yarn add prisma --dev
The reason for this is that a number of users were experiencing issues when running the 
npx prisma
 command. Without a local installation of the 
@prisma/cli
 package, this would invoke the Prisma 1 CLI leading to an error message. From now on, 
npx prisma
 is always going to work. 👨‍👩‍👧‍👦 Efficient bulk creates with 
createMany
Insert data a whole lot faster with 
createMany
. Here's an example:
Copy code
const result = await prisma.user.createMany({
  data: [
    { email: "<mailto:alice@prisma.io|alice@prisma.io>" },
    { email: "<mailto:mark@prisma.io|mark@prisma.io>" },
    { email: "<mailto:jackie@prisma.io|jackie@prisma.io>" },
    { email: "<mailto:bob@prisma.io|bob@prisma.io>" },
  ],
});

console.log(`Created ${result.count} users!`);
To enable this feature, add the
createMany
feature flag to your Prisma schema:
Copy code
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["createMany"]
}
Learn more in this issue. ↕️ Order by relation fields with 
orderBy
Ever wish you could order posts by an author's name? Or sort transactions by account? Now you can! We've expanded 
orderBy
 to support ordering by relations:
Copy code
cons posts = await prisma.post.findMany({
  orderBy: [
    {
      author: {
        name: "asc",
      },
    },
  ],
});
To enable this feature, add the
orderByRelations
feature flag to your Prisma schema:
Copy code
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["orderByRelations"]
}
Learn more in this issue. 🦿 Improvements to the 
nativeTypes
 Preview feature
We are working hard on making the Prisma experience smoother for folks that are using the 
nativeTypes
 Preview feature and are getting close to releasing it for General Availability. • New 
Unsupported(type: String)
 type allows to surface any database type in the Prisma schema • New notation for default values via 
dbgenerated(value: String)
• New native type attributes available on PostgreSQL Be sure to check out the release notes for more information on these changes! If you have any feedback for this feature, please share it on GitHub. 🦦 Prisma Client Go gets dynamic filters Give your users more control over how they filter and order their data. Build up filters over time instead of all at once. Here's an example of setting specific attributes dynamically:
Copy code
func CreateUser(w http.ResponseWriter, r *http.Request) {
    var params []db.UserSetParam
    email := r.PostFormValue("email")
    kind := r.PostFormValue("kind")
    if kind == "customer" {
        // Set the referer for users of type customer only
        params = append(params, db.User.Referer.Set(r.Header.Get("Referer"))
    }
    user, err := client.User.CreateOne(
        db.User.Kind.Set(kind),
        db.User.Email.Set(email),
        params...,
    ).Exec(r.Context())
    // ... Handle the response
}
🇷🇴 2
🇺🇦 2
🇵🇱 5
prisma green 15
🇮🇳 5
🇻🇪 4
🇰🇷 13
germany parrot 8
🇳🇬 4
prisma cool 8
🇨🇴 3
🇨🇳 2
prisma rainbow 37
fast parrot 22
🥰 10
🇳🇴 3
🇰🇪 2
southafrica parrot 2
💯 12