Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,231
  • Linux
  • Apple
create.ts2.46 kB
import { randomBytes } from 'crypto' import testMatrix from './_matrix' // @ts-ignore import type { PrismaClient } from './generated/prisma/client' declare let prisma: PrismaClient testMatrix.setupTestSuite(() => { test('create with connect 1 unique (PK)', async () => { const userId = randomBytes(12).toString('hex') const userReferralId = randomBytes(12).toString('hex') await prisma.user.create({ data: { id: userId, referralId: userReferralId, payment: { create: {} }, }, }) await prisma.profile.create({ data: { alias: 'john1', email: 'john1@doe.io', user: { connect: { id: userId, }, }, }, }) const user = await prisma.user.findUnique({ where: { id: userId, }, include: { profile: true, }, }) expect(user?.profile).toBeTruthy() }) test('create with connect 2 uniques (PK & non-PK)', async () => { const userId = randomBytes(12).toString('hex') const userReferralId = randomBytes(12).toString('hex') await prisma.user.create({ data: { id: userId, referralId: userReferralId, payment: { create: {}, }, }, }) await prisma.profile.create({ data: { alias: 'john2', email: 'john2@doe.io', user: { connect: { id: userId, referralId: userReferralId, }, }, }, }) const user = await prisma.user.findUnique({ where: { id: userId, }, include: { profile: true, }, }) expect(user?.profile).toBeTruthy() }) test('create with connect 1 unique (non-PK)', async () => { const userId = randomBytes(12).toString('hex') const userReferralId = randomBytes(12).toString('hex') await prisma.user.create({ data: { id: userId, referralId: userReferralId, payment: { create: {} }, }, }) await prisma.profile.create({ data: { alias: 'john3', email: 'john3@doe.io', user: { connect: { referralId: userReferralId, }, }, }, }) const user = await prisma.user.findUnique({ where: { id: userId, }, include: { profile: true, }, }) expect(user?.profile).toBeTruthy() }) })

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prisma/prisma'

If you have feedback or need assistance with the MCP directory API, please join our Discord server