Logan
08/23/2022, 11:51 AMgiveawayId
in the giveawayEntry
table is a foreign key to the id
field in the giveaway
table. I'm not 100% confident in my schema setup - which could be the problem.
const findGiveaway = await client.prisma.giveaway.findFirst({
where: {
messageId: interaction.message.id
}
})
const findUser = await client.prisma.giveawayEntry.findFirst({
where: {
userId: interaction.user.id,
giveawayId: findGiveaway.id,
}
})
model Giveaway {
id Int @id @default(autoincrement())
messageId String @db.VarChar(20)
GiveawayEntry GiveawayEntry?
}
model GiveawayEntry {
id Int @id @default(autoincrement())
userId String @db.VarChar(20)
giveawayId Giveaway @relation(fields: [id], references: [id])
}
The error is appearing on the line giveawayId: findGiveaway.id, in the second query to check if the user has already entered the giveaway.
Type 'number' is not assignable to type '(Without<GiveawayRelationFilter, GiveawayWhereInput> & GiveawayWhereInput) | (Without<GiveawayWhereInput, GiveawayRelationFilter> & GiveawayRelationFilter) | undefined'
Zahra Mumtaz
08/23/2022, 12:09 PMSalman Shaikh
08/23/2022, 1:32 PMGreg Mckeon
08/23/2022, 3:48 PMPhorcys
08/23/2022, 4:05 PMRichard
08/23/2022, 5:03 PMnpx prisma generate
on a stackblitz repo that contains a prisma schema. Is there another way to run prisma's generator command in the browser? 🤔
Context: I want to generate a DBML schema with this stackblitz via the community generator prisma-dbml-generator
Error: > Downloading Prisma engines for Node-API for debian-openssl-1.1.x [] 0%
<- it's stuck hereDave Edelhart
08/23/2022, 6:30 PMDave Edelhart
08/23/2022, 7:33 PMHorizonXP
08/23/2022, 11:29 PM22P03
. Message: `db error: ERROR: incorrect binary data format in bind parameter 26`","meta":{"code":"22P03","message":"db error: ERROR: incorrect binary data format in bind parameter 26"},"stack":"Error: Raw query failed. Code: 22P03
. Message: `db error: ERROR: incorrect binary data format in bind parameter 26`\n at RequestHandler.handleRequestError (/home/site/wwwroot/node_modules/@prisma/client/runtime/index.js2883113)\n at RequestHandler.request (/home/site/wwwroot/node_modules/@prisma/client/runtime/index.js2881312)\n at async Proxy._request (/home/site/wwwroot/node_modules/@prisma/client/runtime/index.js2973816)\n at async DeferralService.upsertDeferralChangeLog (/home/site/wwwroot/dist/src/deferral/deferral.service.js37538)\n at async target (/home/site/wwwroot/node_modules/@nestjs/core/helpers/external-context-creator.js7728)\n at async Object.upsertDeferralChangeLog (/home/site/wwwroot/node_modules/@nestjs/core/helpers/external-proxy.js924)","timestamp":"2022-08-23T215556.454Z"}`Dave Edelhart
08/24/2022, 3:52 AMmodel states {
id String @id
hindexes String[]
administrative_area_level Int
administrative_area_level_1 String
administrative_area_level_2 String
}
If I want to find all states that include a given string in hIndexes, what does the “where” look like?(postgres FWIW)Jijin P
08/24/2022, 9:27 AMRichard
08/24/2022, 9:35 AMReuben Porter
08/24/2022, 11:51 AMItalo Gama
08/24/2022, 1:12 PMItalo Gama
08/24/2022, 1:14 PMItalo Gama
08/24/2022, 1:16 PMItalo Gama
08/24/2022, 1:16 PMLogan
08/24/2022, 1:19 PMwhere: {key: value}
value is undefined, or null it wont find anything?
Currently the following query will count all documents if the input is null
or undefined
and it also works the same was for findFirst
.
const entriesCount = await client.prisma.giveawayEntry.count({
where: {
giveawayId: findGiveaway?.id,
},
});
Hayley Dawson
08/24/2022, 5:12 PMRay Tiley
08/24/2022, 5:24 PMRay Tiley
08/24/2022, 5:25 PMHayley Dawson
08/24/2022, 5:50 PMHayley Dawson
08/24/2022, 5:50 PMBoo
08/24/2022, 7:18 PMVanessa Kroeker
08/24/2022, 8:00 PMPrisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "dbname", schema "public" at "localhost:5432"
Error: Migration engine exited.
So I have also added prisma version
, and get the error that migration-engine binary is not found. (will post full out put of in comment to follow)nick
08/24/2022, 9:01 PMnick
08/24/2022, 9:01 PMnick
08/24/2022, 9:01 PMZac Zajdel
08/25/2022, 3:13 AMconst deletedJot = await prisma.jot.update({
where: {
id: jot.id,
userId: session.user.id,
},
data: {
deletedAt: new Date(),
},
})
^ This will not work currently in prisma because you can only use where on unique fields when using .update()
.
Now I realize I can use .updateMany()
but that won't return the model for obvious reasons so if I wanna send back the updated model, I now have to make an additional query to grab that which seems unnecessary.
Is this in the roadmap to NOT enforce only unique fields for a multiple where condition? It seems like a lot of people online have ran into this same thing and adopting Prisma so early on and finding such a hard blocker makes me question using it even though I find so many amazing things this ORM can do and the innovation this team is doing for the ecosystem and leading the industry in an amazing direction.
Thanks for reading my rant everyone 😄Benjamin FROLICHER
08/25/2022, 5:23 AMconst apps = await this.prisma.app.findMany({
where : {
OR: [
{ name : { contains: search, mode: 'insensitive' }},
{ tags : {
hasSome: search // <---- unable to set insensitive search mode.
}}
]
}
})
I have found a related feature request https://github.com/prisma/prisma/issues/8387
Do you have a solution while waiting for official support ?