Setting the file. One moment.
Subchapter 7.7
references/v7-sqlite.mdMarkdown3 KBView on GitHub
Configure Prisma ORM 7 with SQLite. For an existing Prisma 6 app, keep its configuration and use the Prisma 6 docs; the configuration and adapter examples below are for 7.
In prisma/schema.prisma:
datasource db {
provider = "sqlite"
}
generator client {
provider = "prisma-client"
output = "../generated"
}In prisma.config.ts:
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
datasource: {
url: env('DATABASE_URL'),
},
})In .env:
DATABASE_URL="file:./dev.db"file:PATHprisma.config.ts if you need to confirm how your app resolves it.Use a driver adapter for the standard SQL workflow.
Install adapter and driver:
npm install @prisma/adapter-better-sqlite3@7 better-sqlite3Instantiate Prisma Client with the adapter:
import 'dotenv/config'
import { PrismaClient } from '../generated/client'
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
const adapter = new PrismaBetterSqlite3({
url: process.env.DATABASE_URL!,
})
const prisma = new PrismaClient({ adapter })For edge compatibility or Turso:
Install:
npm install @prisma/adapter-libsql@7 @libsql/clientInstantiate:
import 'dotenv/config'
import { PrismaClient } from '../generated/client'
import { PrismaLibSql } from '@prisma/adapter-libsql'
const adapter = new PrismaLibSql({
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
})
const prisma = new PrismaClient({ adapter })String[] is not supported directly.Check the resolved file path for both the CLI and the runtime adapter; relative paths can resolve differently. Use an explicit path to the intended file rather than silently creating a second database.