Prisma

P

Prisma

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

Join

FindUnique/Update using unique index on sub field

Hi, I need some help with generating a schema where I can query indexed sub fields. I've looked for solutions but I couldn't really find a thread matching my problem. Let me sketch an example. (I'm working with Prisma ORM with MongoDB)...
Solution:
Hi Raphael, Thanks for your fast reply. I've tinkered with this some more and found out it actually can be done. However the subfield should have a name that is not inside the model. ...

Concurrent request (Prisma)

Hello, I have a problem with Prisma on PostgreSQL. I don't know how to fix it
Context...

TypedSQL for SQL Server?

Are there any plans of adding support for SQL Server in TypedSQL? Seems like it wasn't even mentioned in the announcement nor was its lack of support mentioned. Only found out when I tried to use it.
Solution:
Hello @PlanetTeamSpeak 👋 We do have a feature request for adding support of SQL server for TypedSQL here: https://github.com/prisma/prisma/issues/25215 ...

Connecting to MySQL server in production.

Hosted by DreamHost, my MySQL server in phpmyadmin cannot be connected by my NextJS application on DigitalOcean's app platform. I am faced with this error:
Error querying the database: Unknown authentication plugin `sha256_password'.
Error querying the database: Unknown authentication plugin `sha256_password'.
However, in localhost, it connects to the database perfectly. The environment variables are exactly the same....

Two Schemas but only one will stay generated at a time

Title is pretty explanatory. I have two schemas for different databases but I can run generate for one schema and then the other schema starts to have error lines in vscode, then generating the other schema swaps the errors to the first schema. Any way to fix this it’s pretty annoying.

Broken JsDoc on prisma Upgrade from 4 to 5.22

I just upgraded the Prisma version from 4 to 5.22 and noticed that my IDE no longer recognizes some typedefs I was using. I used to create a Typedef file to use the Prisma types in JSdoc. - Prisma version: 5.22 - NodeJs 20...

Optimize not showing recommendations for a finished recording (+ feature requests)

I've just started using Prisma Optimize and wanted to flag one bug and a couple of feature requests. 1. I'm not seeing any recommendations for either of the finished recordings 2. It would be super helpful to be able to sort the queries/groups tables by the columns, otherwise it's very inefficient to go through it to identify slowest ones (this might be less pressing depending on what the recommendations tab looks like when working. 3. Ability to name recordings would help to organize things...
No description

Best way to look for text in a deeply nested JSON?

I have a JSON field in a table. Which holds the metadata for the row. So what will be in the JSON is kind of unpredictable. Because it'll store tiptap editor json, other json etc., Here are the few examples Example 1:...
Solution:
Okay, I did this. `` const postsWithMeta = await db.$queryRaw<Posts[]> SELECT p.* FROM "Posts" p...

Raw SQL returns ~5x slower than CLI / `pg` package

I have a query that returns 170k rows of two 4-byte integer (so ~1.5MB total). When I run this on the CLI (pgsql), I get a ~500ms runtime. Using queryRawUnsafe or queryRaw. the query is 2-3 secs. I even hooked up the pg package and confirmed it is around ~500ms....

Infer type from create query?

here's the function that creates a new Schedule. Attention to the shape, not data ```ts async function createSchedule() { return db.schedule.create({ data: {...

Tracing / OTEL only works with manual active spans.

I have just spent a few hours pulling my hair out to no avail. I tried to boil things down simply: Ths code does not submit any traces to the console nor Jaeger UI: ```import { OTLPTraceExporter } from " // Configure the trace provider...

Dynamic Database Name Support in Studio

I’m facing a recurring issue during development that forces me to duplicate projects just to manage different .env files. Let me explain the scenario: Currently, I’m working on a project with a MASTER database that handles tenant access and several TENANT_###### databases, each specific to a client. Here’s the workflow:...

Is there no more online database browser from prisma?

I remember a while back cloud.prisma.io had a visual database browser that one of my projects really dependended on, now it doesn't seem to exist anymore. What can I do about this?

narrow down String type using prisma client's extension?

can I explain to prisma client and typescript that this particular field needs to be a string union? ```ts model Lesson { id Int @id @default(autoincrement()) type String? // null | "practical" | "seminar" | "lecture"...

help with relations

I want the Meal model to kepp track of the absent familyMembers without having to store the data on the familyMember model.

License details for Studio

Hi folks, From asking the AI, it is my understanding that although the source code isn’t available, I don’t have to pay to use Prisma Studio. 1. Does that extend to redistribution? For example, what if I build a project, charge for it, and it contains Prisma Studio in the stack? Is that allowed? ...

mongo dates without JS Date object?

is it possible to insert a document where a property is 'dateTime' without having it be a date object? I'm open to using rawCommand as well. The issue is i've build a logging service and each log has about 15-16 timestamp, which I'll want to query on for insight later on, but would involve having to convert each date on the incoming log, which are many, so ideally I'd find a way around that....

using mongo -- insert document without any checks whatsoever?

I have a logging service and <some> of the data won't exactly quite match, especially the underlying types. I still want to have a bit of a mix between what I 100% expect to be there (like createdAt and such) and use prisma to query them -- but want to be able to not throw an error when trying to insert something that doesn't 100% match the schema (extra values basically); Is there a way to achieve this with prisma?...

gin index

how would I indicate this index exists on my prisma schema...
CREATE INDEX ON my_table USING gin (my_string_column gin_trgm_ops);
CREATE INDEX ON my_table USING gin (my_string_column gin_trgm_ops);
...