Prisma

P

Prisma

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

Join

TypedSQL: Passing null values into raw SQL?

I am currently using an aggregate query that returns a boolean that is either true or false if some user (current user) has reacted to a given post. Here is the query (thanks Jon Harrell--if the code has issues it's likely because I've been modifying it): ```SQL -- @param {String} $1:Post ID -- @param {String} $2:User ID...

Date as String, String as Date.

Hi, when I fetch data the type of startDate looks ok as a Date in the intellisense but when I hover the property itself it says it's a string?! And ESlint complains that I can't assign a string to a date help I'm baffled. See pictures. Thx! #help-and-questions...
No description

Optimize + NestJS not working

GM, I checked the whole forum before asking I tried to test with the provided example : https://github.com/nurul3101/Optimize-NestJS/tree/main ...

Filter relationship by value in parent

I have a query where I'm trying to filter related objects by a value that will be found in the root of the query. example ```typescript const response = await prisma.myObject.findMany({ where: {...

Middleware error: PrismaClientKnownRequestError

On localhost it works all fine no error, nothing, but on vercel there is this issue "Middleware error: PrismaClientKnownRequestError: Invalid prisma.subdomain.findFirst() invocation: Error validating datasource db: the URL must start with the protocol prisma://" i dont know why, my env is...

In one of my migration i have

-- CreateExtension
CREATE EXTENSION IF NOT EXISTS "postgis" WITH VERSION "3.2.4";
-- CreateExtension
CREATE EXTENSION IF NOT EXISTS "postgis" WITH VERSION "3.2.4";
...

Does Prisma support MariaDB 10.6

https://www.prisma.io/docs/orm/reference/supported-databases mentioned MariaDB 10.0+ Does the + means 10.0.x or the versions from 10.0 (including 10.6)?...

Way to run migrations & seeding using the PrismaClient

Hi, is it possible to run the migrations and seedings for Prisma at runtime using the PrismaClient instance? Would prevent me from having to bundle all source files into my docker containers as well, since its all compiled down....

Is there a delay in cache invalidation taking effect?

We're on the Pro plan and have recently started using cache invalidation w/ our accelerate queries. We're seeing that queries immediately after cache invalidation are still getting the cached value - is this expected? Our use-case is that we're storing user data in the cache w/ a sanitized version of the user email as cache tag. When a new user signs-up, they'll originally have a null value in the cache. After we create the user in our DB, we invalidate the cache, but we see that queries still get the null value for 1-2 seconds after invalidation. What is the typical delay for invalidating the cache?...

Why is omit not available for this query?

I am using prisma 5.21.1. If I try this call omit is not available why? ```typescript client.profile.findFirst({ omit: { password: true,...

How to use set a relation and update in the same time rows

Hey ! I wanted to know if someone know how to achieve this : ```ts const data: Prisma.ModuleUpdateInput = { name: input.name, description: input.description,...

How risky is Prisma Postgres now ?

Hi people, I just read on Pirsma doc that Prisma Postgres contains a risk on total data loss. Yet they say it's because of the absence of automated backups only I'm still worried, can I use it for my hobby project or should I wait ?
Solution:
Hi @rj_franc0 👋 You can use it for your hobby project but you would be responsible for manually backing up your data to mitigate the risk. If the risk of losing data is acceptable and you don’t mind occasionally exporting your data manually, Prisma Postgres could work well for you....

Prisma Postgres Pricing

The pricing is unclear when comparing to pricing pages such as Supabase. I see on the starter/free plan it notes "...

prisma postgres

In the new prisma postgres serverless. Can i connect on it as usual? using postgresql://user:password@host:port/database format?

Need Help with CRUD operations

Hey devs, I have been facing this error where my component expects a user ID which was not provided. I need to refractor my backend and all so that my app doesn't need a user ID to make any CRUD operation. The more I am doing the changes, the more I am getting more errors. I am new to Prisma. Can someone help me out, please?

Fail first deployment with typesafe raw query

The prisma generate --sql needs the queried tables/models to exist in the database. So if it's the first time you deploy, this build command will fail. prisma generate --sql --no-engine && prisma migrate deploy && next build But without --sql it will also fail....

How do you approach local development with db changes?

Hi all, I'm using a standard next.js prisma setup. I was wondering how teams approach migrations on separate branches, and handling merging and undoing them. ie if i start a migration on my branch, but decide not to keep it, how do I undo those changes when I go back to my main branch? in traditional worlds I'd run a down migration on the branch before i switch to main, curious if a similar concept exists here in prisma....

Help. Prisma ORM is not loading environment variables

When I run db:deploy. It always errors saying DATABASE_URL was not found if the DATABASE_URL is not present on a .env file. I've run echo $DATABASE_URL it returns postgres://pos... (the correct DATABASE_URL). If this same DATABASE_URL is present on a .env file. It works correctly. I'm using the folder schemas, so I tried to make the schema path explicit like this:" "db:deploy": "prisma migrate deploy --schema ./prisma/schema"...

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?...