No Rust engine
As of v6.7.0, you can use Prisma ORM without Rust engine binaries on SQLite or PostgreSQL databases.
This page gives an overview of how to use this version of Prisma ORM.
Prisma ORM without Rust engines
The main technical differences if you're using Prisma ORM without a Rust engine are:
- no
binaryTargets
andengineType
fields on thegenerator
block - no query engine binary that's downloaded into the directory with your generated Prisma Client
- required usage of driver adapters for database connection management
Usage
Prerequisites
- Prisma ORM v6.7.0 (or later)
1. Set feature flags
Usage of the new architecture requires the driverAdapters
and queryCompiler
feature flags to be set:
generator client {
provider = "prisma-client-js" // or `prisma-client`
previewFeatures = ["queryCompiler", "driverAdapters"]
output = "../generated/prisma"
}
2. Re-generate Prisma Client
To make the feature flags take effect, you need re-generate Prisma Client:
npx prisma generate
3. Install the driver adapter
Depending on the database you use, you need to install a different driver adapter library:
For PostgreSQL:
npm install @prisma/adapter-pg
For SQLite:
npm install @prisma/adapter-better-sqlite3
4. Instantiate Prisma Client
Finally, you need to instantiate Prisma Client which you can do using the driver adapter and the connection URL for the database instance you're using.
For PostgreSQL:
import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from './generated/prisma'
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
For SQLite:
import { PrismaBetterSQLite3 } from '@prisma/adapter-better-sqlite3';
import { PrismaClient } from './generated/prisma';
const adapter = new PrismaBetterSQLite3({ url: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter });
5. Query your database
If you went through the previous steps, you can query your database as you're used to with Prisma Client. No other changes are needed.