@stitchdb/prisma
v1.0.0
Published
StitchDB driver adapter for Prisma
Downloads
71
Readme
@stitchdb/prisma
Prisma driver adapter for StitchDB.
Install
npm install @stitchdb/prisma @prisma/clientSetup
import { PrismaClient } from '@prisma/client'
import { createAdapter } from '@stitchdb/prisma'
const adapter = createAdapter({ apiKey: process.env.STITCHDB_API_KEY })
const prisma = new PrismaClient({ adapter })Set your schema.prisma datasource to sqlite:
datasource db {
provider = "sqlite"
url = "file:./placeholder"
}The adapter overrides the connection — the url is not used.
Usage
const users = await prisma.user.findMany({ where: { active: true } })
await prisma.user.create({ data: { name: 'Alice', email: '[email protected]' } })
await prisma.user.update({ where: { id: 1 }, data: { name: 'Bob' } })
await prisma.user.delete({ where: { id: 1 } })