Raoul
04/24/2021, 7:30 AMcase when
inside the aggregation sum from Prisma client? Something like:
SELECT
title,
SUM(CASE WHEN some_date <= date('YYYY-MM-DD') THEN amount
ELSE 0 END)
FROM test
GROUP BY title;
Sergey Bedritsky
04/25/2021, 10:00 PMpropagandalf
04/25/2021, 10:46 PMYuukiKanasugi
04/26/2021, 7:28 AMyoenho park
04/26/2021, 8:33 AMNatalia
Gustav Ahlberg
04/26/2021, 12:52 PM*ScalarFieldEnum
but I'm thinking it might be an easier way to get it programmatically?
My use case is that in a middleware I want to rewrite a where statement to search in another field if it exists.
prisma.model.findFirst({ where: firstName: 'max' })
but I want to rewrite that to
prisma.model.findFirst({ where: firstName_hash: 'HASH OF FIRSTNAME' })
iff the firstName_hash
field exists?nikolasburk
James
04/27/2021, 3:47 AMehodges
04/27/2021, 10:25 PMnpx prisma migrate dev --schema=./prisma/schema.prisma
showing that it tries to connect to an older DB:
✔️ Drift detected: Your database schema is not in sync with your migration history.
We need to reset the PostgreSQL database "next-auth-test" at "localhost:5432".
Do you want to continue? All data will be lost.
How do I fix this?Alexis
04/28/2021, 12:59 AMProperty 'id' does not exist on type 'JsonValue'.
model Guild {
id String @id
prefix String?
locale String?
tags Json[]
}
Alexis
04/28/2021, 12:59 AMinterface Tag {
id: string,
body: string
}
Carlos
04/28/2021, 4:27 AMCarlos
04/28/2021, 4:31 AMLucas
04/28/2021, 10:29 AMuuid
? https://www.prisma.io/docs/concepts/components/prisma-client/database-polyfills. Basically all my tables will need a binary(16) column which will have a uuid generated in runtime. Does prisma have a middlewre or something to automatically add that before every inserting or any better way to create a new custom attribute in prisma.model
?Martin Duris
04/28/2021, 11:53 AMstephan levi
04/28/2021, 12:18 PMNatalia
Alex Ruheni
Jared Salzano
04/28/2021, 7:09 PMJared Salzano
04/28/2021, 7:41 PMKhrisF999
04/29/2021, 12:46 AMCarlos
04/29/2021, 4:37 AMAlex Szekely
04/29/2021, 6:55 AMError: Database error
Error querying the database: Server error: `ERROR 42000 (1061): Duplicate key name 'accounts_id_with_roles_id_index''
0: migration_core::api::ApplyMigrations
at migration-engine/core/src/api.rs:73
But this index wasn't modified. Yet it tries to define the index again and the put the connected line into the new migration file.
Why?
And that is problem if I delete this line from the new migration file manually?Dog
04/29/2021, 9:17 PMuser User @relation(fields: [userId], references: [id])
userId Int
But then when it gets generated with typegraphql-prisma this happens
user?: User;
userId: number;
The issue is that (for some reason I don't understand) it doesnt appear in my graphql docs anywhere??? No idea why. It's like the field does not existDog
04/29/2021, 9:21 PMJared Salzano
04/29/2021, 10:46 PMJared Salzano
04/29/2021, 10:47 PMJeff Guy
04/29/2021, 10:53 PMkitze
04/30/2021, 4:55 AMprisma migrate reset --force
a stubborn db that has extensions? (hosted on render .com)