Prisma

P

Prisma

Join the community to ask questions about Prisma and get answers from other members.

Join

npx prisma migrate dev --name init (stuck)

Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "postgres", schema "public" at "aws-0-us-east-1.pooler.supabase.com:6543"...

Filtering an array

Hi, my question is very simple. For a column, let's call it transportation. { "transportation": { "array_contains": [ "bike"...

Generate prism client

I already have a MySQL database, and with data inside, how can I generate my prism in my app without affecting this data?

Uploading image

Anyone can help me with uploading images to the server? I did this using nulter but keep getting 500 interal server error when trying to make the post reqest on postman by uploading an image ```import express, { Express, Request, Response } from 'express' import { PORT } from './secrets' import rootRouter from './routes' import { PrismaClient } from '@prisma/client' import { errorMiddleware } from './middlewares/errors'...

binaries.prisma.sh Gives Not Found Error

I'm using Prisma on NixOS, configured as per this GitHub issue, and things have worked properly in the past. However, currently when the CLI tries to download the proper files for the prisma engine, it encounteres a "Not Found" error (see below). ``` ❯ prisma --version Warning Precompiled engine files are not available for nixos....
No description

prisma migrate dev wants to drop all tables

Hello! I am using Prisma in a Sveltekit application deployed to Vercel. I also use the Vercel Postgres database. I am trying to add a model to the schema and then update a relation between two models, but when I run prisma migrate dev --create-only the generated migration drops and re-create the whole database structure. I am missing something?

schema env file

Is there a way to dinamically chose the env file that schema.prisma will use? For example: ``` datasource db { provider = "mysql"...

nextjs + prisma + superbase working is developement only

Please i need help, the app is hosted on netlify but can't build after initial build. got the attached error
No description

Dynamic database

is there anyway to change the database in the query? i have tried with new PrismaClient({datasourceUrl: ''}) but seem not working, i am using sqlserver...

Field excluded when running prisma query to supabase

The following code: ``` const user = await prisma.user.findFirst({ where: { email: email } }); console.log("user:", user);...
No description

Why can't I access profile in user? (ORM) (Postgres)

With these models: ``` model User { id Int @id @default(autoincrement()) email String @unique...
Solution:
Fix: deleted and created my database instead of migration; i was using a completely different setup earlier and the migration must have corrupted some things

Is it bad practice to depend on the unique constraint while creating a new object?

In my example: I have a User model with unique email. Should I be checking beforehand if the email already exists or does it not really matter because it will throw an error?

circular variable reference issues

I'm currently using Prisma with Next.js app router/API routes and Postgres to manage our backend. We've been running into some strange problems - every time we try to call an API route, we get a massive spam of code in the terminal followed by the following error: What we've done to resolve: - Looked over schema for circular references...
No description

Raw SQL generated for cursor using libsql issue

To start with I am using: ``` "@libsql/client": "0.6.1", "@prisma/adapter-libsql": "5.14.0", "@prisma/client": "5.14.0",...
Solution:
Alright, so I figured out the issue is coming from "You must sort by your cursor, which has to be a unique, sequential column."

prisma.transaction.findMany() not working

i have a transactions table in my database and transaction model. when i use prisma.transaction.findMany() it not working.

Cleaning code

So, just building a basic scoreboard side project, which I need teams and scores for it. Is there any ways to clean up these models? They just seem kinda clunky to me, dunno if I'm the problem here. ```proto model Team {...

How to push changes to already deployed db?

I have an already deployed db on cockroach db and I have added the index for one filed in atable schema. Now I want to push the changes so that index is added. How can I do this. I read the docs and it said not to use the push for production environment....

check connection - prisma nextjs

How can I check prisma connection before querying using await prisma.user.findMany() I have the client, but need to check if it was able to connect to my postgres database before i try to query, else i get error if not able to connect to database...

Lock tables

I want to lock write mode of a table before executing a prisma query. How I can achieve this. Please help me

500 (Internal Server Error) from simple query

I am running the following query: ``` import { unstable_noStore as noStore } from "next/cache"; import { NextResponse } from "next/server"; import { prisma } from "@/db/client";...
No description