Prisma Unable To Query Indexed Fields

https://pastes.dev/Eir02TMjVU ^ my whole schema file I've generated and pushed multiple times, but I still can't query on the indexed fields..
pastes | Eir02TMjVU
A paste containing 90 lines of javascript.
26 Replies
Finn
Finn15mo ago
you need to add a unique constraint @Hycord what columns are you wanting to use
Hycord | @ When Replying
both name and userId
Finn
Finn15mo ago
add a
Hycord | @ When Replying
name is not unique, nor is userId, but they are unique together
Finn
Finn15mo ago
@unique([ name,userId ]) ue ye dont forget to add a index aswell
Hycord | @ When Replying
where do I add that?
Finn
Finn15mo ago
in the badge table
luka
luka15mo ago
In schema
Hycord | @ When Replying
which field should be unique
Finn
Finn15mo ago
@unique([ name,userId ]) both together
Hycord | @ When Replying
both the name and userId field should have that decorator following their type? in the badge model correct?
Finn
Finn15mo ago
nah just paste this in lol @unique( name, userId ])
Hycord | @ When Replying
ahh ok thankyou
Finn
Finn15mo ago
nw
Hycord | @ When Replying
@@unique([name,userId]) @@index([name,userId]) or do I not need that index?
Finn
Finn15mo ago
ide add an index yeah your using pscale right?
Finn
Finn15mo ago
ye
Hycord | @ When Replying
Is there anything else obvious that I messed up
Finn
Finn15mo ago
no? pnpm prisma generate and then restart vsc oh and push is it working?
Hycord | @ When Replying
About to test had to completely rewrite a couple functions hmm not working at first let me do some debugging
Finn
Finn15mo ago
can send the errors here if you want @Hycord
Hycord | @ When Replying
no errors, just my implementation isn't showing me what i need it to LOL I'm just dumb The user wasn't in the database xD either way I needed to figure that out so
Finn
Finn15mo ago
lol
Hycord | @ When Replying
The issue here just helped me drastically reduce my idle time waiting for db queries to go through lol
Finn
Finn15mo ago
hell yeah!
Want results from more Discord servers?
Add your server
More Posts
Global data fetchingUsing non-app directory Next.js 13 (latest T3), how do you go about fetching data to be consumed gloWhat would be a good practice for writing types for components that get passed a trpc query?lets say a query looks like this: ```ts const item = await prisma.business.findFirst({ Question about the use of useSession() callbackWhy do all of the examples do the const {data:sessionData} for the callback when you can just write tRPC query 'train'. what's the correct method to grab data from multiple sources?I'm going to make an example as I'm either struggling to understand or am building my database wrongTailwindCSS and CVA autocompleteHi guys, i'm using CVA with TailwindCSS for building complex state components, but a particular thinSession Auth without Next-AuthHi all, I’m primarily a backend dev with experience using Express/Fastify with session-based authen[PRISMA] Value out of range for the type ERRORI am attempting to create a headless wordpress setup with t3 1) I created a new wordpress instance CSS gradient border - irregular shapeDo we have CSS masters here? https://stackoverflow.com/questions/75890709/gradient-border-on-irregStoring a snapshot of quizzes and responses in a PostgreSQL databaseI am building an application that allows users to create quizzes and other users to solve them. The How would you structure this Component? A challenge to all advanced React users...I'm having a bit of trouble structuring this component and I really don't know what to do about my d