Brokenwind
Brokenwind
Explore posts from servers
PPrisma
Created by Brokenwind on 1/13/2025 in #help-and-questions
Prisma.skip on deeply nested objects
Hey, thanks for responding. In my specific example:
territory: {
id: territoryId ?? Prisma.skip,
district: {
id: districtId ?? Prisma.skip,
region: {
id: regionId ?? Prisma.skip,
},
},
},
territory: {
id: territoryId ?? Prisma.skip,
district: {
id: districtId ?? Prisma.skip,
region: {
id: regionId ?? Prisma.skip,
},
},
},
I have this structure in place so I can supply the territoryId, districtId, regionId when filtering. This allows me to have dynamic filtering and I want to supply these as needed. Just giving them territoryId, districtId, or regionId works in itself and filters through that. My issue is when I have those 3 undefined. It will use Prisma.skip as intended but it doesn't give me the result I want. The result that I want is to not filter any by territory at all. Instead, prisma (I believe) is filtering where territories are undefined (which shouldn't because I have strictUndefinedChecks) and I get no result. When I log the filters, this is what it looks like: territory: { id: dr {}, district: { id: dr {}, region: { id: dr {}, } } } Which is what prisma does when all three are undefined. Currently, this works for me:
territory:
territoryId || districtId || regionId
? {
id: territoryId ?? Prisma.skip,
district: {
id: districtId ?? Prisma.skip,
region: {
id: regionId ?? Prisma.skip,
},
},
}
: Prisma.skip,
territory:
territoryId || districtId || regionId
? {
id: territoryId ?? Prisma.skip,
district: {
id: districtId ?? Prisma.skip,
region: {
id: regionId ?? Prisma.skip,
},
},
}
: Prisma.skip,
In my opinion, if this is the structure:
territory: {
id: Prisma.skip,
district: {
id: Prisma.skip,
region: {
id: Prisma.skip,
},
},
}
territory: {
id: Prisma.skip,
district: {
id: Prisma.skip,
region: {
id: Prisma.skip,
},
},
}
It should just skip it. My workaround is ugly code and I wish I didn't need that.
4 replies
DTDrizzle Team
Created by Brokenwind on 11/25/2024 in #help
Unable to sort relational query
I've read in other places that this feature isn't available yet, tho I've seen it working in a drizzle.run site
5 replies
DTDrizzle Team
Created by Brokenwind on 11/25/2024 in #help
Unable to sort relational query
Nothing happens (it doesn't sort) but I do get TypeScript errors: Object literal may only specify known properties, and 'orderBy' does not exist in type
5 replies
DTDrizzle Team
Created by Brokenwind on 11/13/2024 in #help
Optionally migrate a table.
I didn't see this but from the looks of it, it might be what I was actually looking for. I'll give it a shot thanks!
3 replies
DTDrizzle Team
Created by Brokenwind on 6/18/2024 in #help
Can't migrate on vercel postgres
Thanks. It still won't connect on my end. This is probably an issue with Vercel or the latest version of Drizzle
10 replies
DTDrizzle Team
Created by Brokenwind on 6/18/2024 in #help
Can't migrate on vercel postgres
Have you resolved your issue? Are you able to connect to Vercel now?
10 replies
DTDrizzle Team
Created by Brokenwind on 6/18/2024 in #help
Can't migrate on vercel postgres
Got it. Thanks
10 replies
DTDrizzle Team
Created by Brokenwind on 6/18/2024 in #help
Can't migrate on vercel postgres
That's strange.
Resolved - This incident has been resolved. Jun 18, 14:44 UTC
Are you still having issues with it?
10 replies
DTDrizzle Team
Created by Brokenwind on 6/18/2024 in #help
Can't migrate on vercel postgres
I see, I'm from SEA and I'm using sin1. Hope they would resolve it or at least post it in status. I've checked vercel-status earlier and did not see any issues posted.
10 replies