apps/blog/content/blog/orm-v6-17-0-new-usage-metrics-and-direct-connections-in-ga-for-prisma-postgres/index.mdx
We just released Prisma ORM v6.17.0 with several bug fixes and improvements. Additionally, connecting to Prisma Postgres using your favorite ORM or DB tool is now Generally Available. Check out the article for even more updates!
Want to use Prisma Postgres with Drizzle, Kysely or connect to it from a DB GUI like Postico or TablePlus?
Using Prisma Postgres with Prisma ORM is great because it gives you connection pooling, global caching and overall an amazing DX.
That being said, we understand that preferences vary and some developers prefer to use plain SQL or lower-level query builders in their applications. As of this release, these ways for connecting to Prisma Postgres are now officially Generally Available (GA) and can be used in your production apps!
You can connect using Drizzle, Kysely, TypeORM, psql, or any other Postgres-compatible library, database migration tools like Atlas or interfaces like DBeaver, Postico, and more.
Want to see all your Prisma Postgres usage at a glance?
The Dashboard in Prisma Console now gives you a clear, at-a-glance view of Prisma Postgres usage so you can make faster, smarter decisions.
Here's what's new:
config object to configure DefaultAzureCredential:
import { PrismaMssql } from '@prisma/adapter-mssql'
import { PrismaClient } from '@prisma/client'
const config = {
server: 'localhost',
port: 1433,
database: 'mydb',
authentication: {
type: 'azure-active-directory-default',
},
options: {
encrypt: true,
},
}
const adapter = new PrismaMssql(config)
const prisma = new PrismaClient({ adapter })
@opentelemetry/instrumentation to be compatible with ">=0.52.0 <1". Learn more in this PR.We recently made the Rust-free Prisma ORM, ESM-first prisma-client generator and Prisma Config Generally Available. Together, they form the future of Prisma ORM.
As of today, you still need to opt-into using these features, however they'll become the default with the upcoming v7 launch.
We recommend that you give them a try already today! Here's what you need to do:
On the generator block in your Prisma schema:
provider = "prisma-client" and define an output path to use the new ESM-first generatorengineType = "client" to use Prisma ORM without Rust enginesgenerator client {
provider = "prisma-client"
output = "../src/generated/prisma"
engineType = "client"
}
Afterwards, run prisma generate so that your generated Prisma Client gets updated. We also recommend deleting and re-installing node_modules via npm install so that the previous version of prisma-client-js inside node_modules gets cleared properly.
If you're using Prisma ORM without Rust engines, you have full control over the database connections by using your preferred JS-native driver library. For example, if you're using PostgreSQL, you can use the pg driver via the @prisma/adapter-pg driver adapter.
First, install the npm library:
npm install @prisma/adapter-pg
Then use the driver adapter to instantiate PrismaClient:
import { PrismaClient } from './generated/prisma'
import { PrismaPg } from '@prisma/adapter-pg'
const adapter = new PrismaPg({ connectionString: env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
// ... send queries using `prisma` like before
Prisma Config is the new way for configuring your Prisma projects directly in TypeScript.
To start using it, you can simply create a prisma.config.ts file and set it up as follows:
import { defineConfig } from "prisma/config";
export default defineConfig({
// put config options here
});
As an example, this is what it looks like when you configured the location of your Prisma schema and migrations directory via Prisma Config:
import path from "node:path";
import { defineConfig } from "prisma/config";
export default defineConfig({
schema: path.join("prisma", "schema.prisma"),
migrations: {
path: path.join("prisma", "migrations"),
},
});
For a full reference of the options that can be used in Prisma Config, see the docs.
Note: When using Prisma Config, automatic loading of env vars is disabled. This means you need to manually load env vars, e.g. using
dotenv.
This week we've launched direct TCP connections for Prisma Postgres, this means you can now connect to Prisma Postgres with any tool in your production applications! Additionally, we've added new musage metrics that show give you the most important information about your database at a single glance!
Let us know your thoughts, questions and feedback on X and join the conversation on Discord.