Dan M
04/02/2022, 7:54 PMexport type PrismaTransactionClient = Omit<PrismaClient, '$connect' | '$disconnect' | '$on' | '$transaction' | '$use'>;
Can this be added to the client generator?Dan M
04/02/2022, 7:56 PMArthur Cachero
04/06/2022, 6:12 AMamock666
04/07/2022, 4:24 PMFreeman Jiang
04/09/2022, 9:30 PMupdateMany
seems like the closest thing, but it’s only letting me update scalar fieldsamock666
04/11/2022, 4:43 AMDavid Marr
04/11/2022, 1:40 PMconnectOrCreate
call. The error I'm getting is saying that the author
arg is unknown. Specifically:
Unknown argin create.author for type TweetUncheckedCreateInput. Did you meanauthor
? Available args:authorId
type TweetUncheckedCreateInput {
id: String
authorId: String
createdAt: DateTime
entities?: Json | Null
media?: MediaUncheckedCreateNestedManyWithoutTweetsInput
mediaKeys?: TweetCreatemediaKeysInput | List<String>
publicMetrics: Json
text: String
type?: String | Null
}The relevant client code is here: https://gist.github.com/marr/c574e7a854223e828e652753d08dd117#file-twitter-ts-L42 and relevant schema is here: https://gist.github.com/marr/0b2e6a58858388df6b448f5d1d2dd879#file-schema-prisma-L23 Can anyone help me troubleshoot this?
David Marr
04/11/2022, 2:52 PMMischa
04/11/2022, 6:12 PMexternalModules
settings? Look no further!
This was developed over many days of grueling testing and trial and error. I hope to spare others the same headache.David Marr
04/11/2022, 7:29 PMtype
cause problems?David Marr
04/15/2022, 3:13 PMDavid Marr
04/17/2022, 1:18 AMType 'JsonObject' must have a '[Symbol.iterator]()' method that returns an iteratorCode in question (mongodb):
const res = await db.tweet.aggregateRaw({
pipeline
});
for (const tweet of res);
Demian N
04/18/2022, 3:49 AMconnect
or not when creating a row with a foreign key field?
I note the result is the same but what would I choose one over the another one? Or this just for a declarative/semantical reason?
Example:
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
rooms Room[]
}
model Room {
id Int @id @default(autoincrement())
userId String
title String
description String @db.Text
user User @relation(fields: [userId], references: [id])
@@unique([userId, title])
}
From the above schema, If I would like to add a new room I could do:
Let's say user
hs already being resolved to a user found in the User model
prisma.room.create({ data: { title, description, user: { connect: { id: user!.id } } }})
or also,
prisma.room.create({ data: { title, description, userId: user!.id }} )
What is the correct way?Jason
04/18/2022, 7:47 AMFilip Woźniczak
04/19/2022, 11:11 AMphone String? @unique
Filip Woźniczak
04/19/2022, 11:11 AMRintsi
04/19/2022, 4:49 PMwhere: { id: { in: identifiers } }
There is so much inception going on that I have hard time keeping up... Express -> NestJS -> PrismaJeet Mehta
04/24/2022, 10:03 PMUser
contains a 1-many link to Services
. We import the User
interface but it only has serviceId
, so in our code user.service
is generating a typescript error (even though the object is present in the data returned from the DB).
Sometimes we access objects several levels deep (i.e. user.service.booking
), just wondering if there's a recommended approach for this.Mischa
04/25/2022, 11:19 AMprisma.queryRaw()
invocation:
Your raw query had an incorrect number of parameters. Expected: 0
, actual: 1
.
What am I doing wrong here?Pinja Jäkkö
04/25/2022, 1:32 PMType '"AnyNull"' is not assignable to type 'JsonNullableFilter | undefined'.
My client configuration looks like this:
generator client {
provider = "prisma-client-js"
previewFeatures = ["filterJson", "interactiveTransactions"]
}
I have a postgresql database, my prisma client version is 3.5.0, and the field I am trying to filter by is an optional JSON field.
the findMany call:
await prisma.chart.findMany({
where: {
oldState: Prisma.AnyNull
},
});
Navin
04/26/2022, 5:10 AMAlex Valle
04/27/2022, 11:22 PMMischa
04/29/2022, 8:31 AMFATAL: sorry, too many clients already
I have connection_limit=5
on my DATABASE_URL
Any idea what to do about this specific error? I think it means too many connections for the specific client?Andrew Hammond
04/29/2022, 4:02 PMNavin
05/01/2022, 4:41 PMAlex Valle
05/02/2022, 10:59 PMRUN npx prism generate
but it makes my image too big.James L
05/02/2022, 11:47 PMname
is equal to foo
? My current hack in raw SQL for when I don't feel like parsing and filtering like an adult is a shameful display of hubris with items::TEXT ~ 'foo'
lol.
Data shape in the "items" column:
[
{
"name": "foo",
"value": "example_1"
},
{
"name": "bar",
"value": "example_2"
},
]
Ben Ezard
05/03/2022, 9:39 AMprisma.$on('query', event => {});
to log queries, but I'd like to be able to associate these queries with a particular HTTP request
In the rest of my codebase, I have a unique "request ID" that I can pass around, so that any logs from the same request can be associated with each other
Is there a way for me to achieve this with regards to logging what Prisma is doing please?James L
05/03/2022, 10:22 AMJames L
05/03/2022, 10:23 AM