Prisma

P

Prisma

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

Join

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);
...

Omit type for creating

However, I can use delete user.password. Is there a way to omit the password when creating a new user? ```.tsx async create(dto: CreateUserDto) { const user = await this.prismaService.instance.user.create({ data: {...

Syncing Prisma across multiple repo's

Multiple of our software's services use prisma ORM to interact with the same DB. However, we oftentimes must manually sync the schema across the different repo's that the services live in when we do a single DB migration. This seems like it would be a common issue, so is there a recommended way to go about this?...

[React Native] DB duplicated to the emulator. Intentional?

Scenario: 1. App has a db.db file and uses it 2. Prisma Studio shows a different sort of data, as if there were 2 separate DBs at the same time, which makes no sense What happens:...
No description

Do transactions work when you nest them?

Hello, I'm trying to figure out if transactions work correctly when you nest them. In my example I've got a couple of pretty complex business-logic-required queries, and each might have their own transactions within them: ...

UnknownJsonError - P6000 - Something went wrong

Hello, I get a strange error using prisma accelerate. What could be the cause? Unknown server error: {"type":"UnknownJsonError","body":{"code":"P6000","message":"Something went wrong."}} (The request id was: 8e16bac8eee93b72) at Yr.handleRequestError (/var/task/node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/runtime/edge.js:20:7527)...

Cant setup prisma accelerate, on the site when i try to enable accelerate I get error

When i try to click enable accelerate with my database connection string i get this error: We were unable to process your request. Please refresh and try again. my database in a MySql one running on Aiven