Prisma

P

Prisma

The official Discord server of Prisma! Find us online at prisma.io

Join

Checking Null or empty list

I have a field of type integer list in my DB. I want to add a filter if is empty or null, ```js { OR: [...

prisma migrate diff freezes

pnpm prisma migrate diff --from-migrations=migrations --to-schema-datamodel=schema.prisma --shadow-databa se-url=$DB_URL Running the above command shows no output for over 2 minutes. How can I know if it's doing something or just stuck? Is there a verbose option to see which db commands it's attempting?...

Live events with prisma pulse for games

Hello , My backend is a traditional transactional backend that serves multiple games at the same time . it stores balance , open chests , give rewards etc , but nothing like a "game server" for real time things , however recently for some games I want to implement real time events such as user is playing (think of it like subway surf) , he reaches some checkpoint/num of minutes , need to grab this event from the game and check if he matches the event requirements and then reward the user with keys , I already have this system with request/response , but now the key should actually directly be spanned into the game , so the game should have a direct instant reward would having web sockets between the game and my server + my server and prisma pulse solve that...

unit testing with @default() value, using jest-mock-extended

Hello :) I'm not sure this is the appropriate place to post this, but I hope I can get some help here. I'm currently working on a project and was looking into unit testing my prisma extended client with unit tests and jest.

pnpm install puts prisma generate in the wrong folder

this is my root pnpm-worspaces.yaml ``` packages: - 'database' - 'website'...

Mongodb, Making Breaking changes to production database

Hi, I'm trying to understand what the suggested way or best practices for making breaking changes to a database in production are. for simplicity sake, let's say I have a schema for mongodb: ``` model User {...

Database connection issues

Hello! Nice to be here! This is my first post! Unfortunately, it's to report issues related to my database connection. I'm trying to open the database from https://console.prisma.io/ but I'm not having any luck. I have no idea if this is a random issue, but my app isn't even in production so I don't think I've exceeded the free quota. I regenerated the API key, but no luck there either. I hope someone can help. Thanks in advance....
No description

@unique and @index can't be used together

If I'm using @@unique([id1, id2]) I cannot use @@index([id1, id2]) That's because @@unique already means indexed??...

MSSQL Authentication failed against database server

I was trying to connect to MSSQL server that runs on azure. Both commands npx prisma db pull and prisma studio are able to connect and pull the data but when I am trying to connect during the runtime of the application, i get PrismaClientInitializationError: Authentication failed against database server at.... I am using a simple DATABASE_URL in a .env file to connect, and here is my db.ts file ```...

Row locking on prisma suggestions

Hi, I have been using Prisma to develop a text based game, this has been going very smooth. However I have been stumbling on some very big issues for concurrent updates on certain rows e.g. auction, withdraw, depositing, where my players can get under their balance if they click very fast, which results in a - balance and offcourse unwanted results. I was able to solve this with raw sql row locking, see picture. However I think the way to do this isn't very smooth and I have to change some extra things on plus to get the collect errors in the frontend. I am contemplating switching from ORM, but I was wondering if there are some better ways to solve these race conditions. I have tried optimistic locking a few weeks ago but had some issues there. I want to have a good decoupled code without having to many changes in response/logic for specific locking cases. Any tips here how I should proceed further?...
No description

`npx prisma init` not working. Open bug?

---> npx prisma init (node:64792) ExperimentalWarning: Support for loading ES Module in require() is an experimental feature and might change at any time (Use node --trace-warnings ... to show where the warning was created) Error: (0 , DSe.isError) is not a function ...

Error

I get a error on my data when i create a user and i saw some blogs where its cus i have information i have mandated to setup but I dont understand what it is since i basically made everything possibly optional. This is the error ype '{ email: string; balance: number; username: string; }' is not assignable to type '(Without<UserCreateInput, UserUncheckedCreateInput> & UserUncheckedCreateInput) ```js...

Prisma Migrations: local, dev and prod

Hi all, I have a specific question on Prisma migrations with next.js and Vercel. For my project I have 3 postgresQL database versions: - Local composed with docker - Dev/preview hosted on Vercel...

Prisma with cockroachDB & Deno

Hi everyone, need a little help here. I'm trying to use Prisma with cockroachDB and Deno. This is the basic schema of my app. When I try to migrate, I get the following error and I don't understand what it is. I'm running cockroachDB locally....
No description

Connect Prisma Postgres without Prisma Client?

Hi there 👋 I am right now trying out the new Prisma hosted Postgres offering. As I want to migrate a bucnh of data from my existing CockroachDB I'd love to connect with the regular psql tooling or other 3rd party SQL tools to the database. However, it seems to me that with the provided credentials I am currently required to use the Prisma client. I build a workaround for now using a seed.js script and npx prisma db seed but having access to a proper postgres connection would still be great....

Custom method in a model, gives a "not found" error

I am trying to create a custom method in my model, but when I try to use it, it says not a function. I am confused by the docs that I quoted below as the works/not works are the same code?
In the above example, prisma.user.signUp works, but prisma.user.signUp does not, because the original prisma is not modified.
https://www.prisma.io/docs/orm/prisma-client/client-extensions/model#example ...

Introspection in the client extensions

Say I have a client exension: ``` new PrismaClient({ }).$extends({ query: { $allModels: {...

how can I implement an abstract class to apply the repository pattern?

I use nestjs and would like to implement the pattern repository as it is used in typeorm ``` import { Prisma, PrismaClient } from '@prisma/client'; import { BaseInterfaceRepository } from './base.interface.repository'; ...

SSL connection to supabase

Hello, I'm developing an application where the stack includes Prisma as an ORM and the database is hosted by supabase. The app is still in development, and I'm unsure how to make the connection between the development environment and the database be SSL encrypted. That, and how to enforce it also on a production environment. As a disclaimer, I'm using: Prisma + Sveltekit + Supabase. I've also tried to put sslmode=require on the database string, but it fails to establish a connection...