Skip to content

Migrating from Prisma

This guide helps you transition from Prisma to db-semantic-planner. Both tools offer type-safe database access, but dbsp takes an intent-first approach that gives you more control and observability over query execution.

Key Differences

ConceptPrismadbsp
Schema definitionschema.prisma (DSL)schema() (TypeScript)
Client generationprisma generate (codegen)No codegen needed
Relationsinclude: { posts: true }.include('posts')
Filteringwhere: { active: true }.where(eq('active', true))
ObservabilityLogging middleware.dump() (plan + SQL + params)
Multi-tenantManual schema switching.withSchema('tenant') built-in
Migrationsprisma migratedbsp verify + generateMigrationSQL()

Quick Translation Reference

Prisma → dbsp

Prismadbsp
prisma.user.findMany()orm.select('users').all()
prisma.user.findUnique({ where: { id } })orm.select('users').where(eq('id', id)).first()
prisma.user.create({ data })orm.insert('users').values(data).execute()
prisma.user.update({ where, data })orm.update('users').set(data).where(...).execute()
prisma.user.delete({ where })orm.delete('users').where(...).execute()
include: { posts: true }.include('posts')
select: { name: true }.columns(['name'])

Released under the MIT License.