Why guys when i run this (pic) it returns me this ...
# orm-help
h
Why guys when i run this (pic) it returns me this error : PrismaClientValidationError: Unknown arg
referrer
in where.referrer for type pageviewWhereUniqueInput. Did you mean
select
?"
m
The where clause in
.update
can have only fields which are marked as
@unique
in your schema (or @id). Maybe you would want to use
.updateMany
h
So how can i work around this ? Because i really want the do this logic : update set referrer_group="Visite dircets" from pageview where referrer =" direct"
Because my pageview model is like this and i dont want to change it
m
updateMany
?
h
yeah but if there is only 1 record it still work ?
something like
"prisma.pageview.updateMany({
await prisma.pageview.updateMany({
     
where: {
       
referrer:{
         
contains: 'direct',
       
}
     
},
     
data: {
       
referrer_group: 'Visites directes',
     
},
   
})
or contains is too much, and just need to where: {referrer: 'direct'} ?
well it doesnt work, update the database but i have no error
m
contains
is probably not necessary. Sorry I don't undestand. What exactly doesn't work?