Halvor
06/05/2022, 5:27 PM-- RenameIndex
ALTER INDEX "Arbitrated_matchId_unique" RENAME TO "Arbitrated_matchId_key";
Using this model:
model Arbitrated {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
match Match @relation(fields: [matchId], references: [id])
matchId Int @unique
session_id String @unique
stats Stat[]
}
Halvor
06/05/2022, 5:29 PMmatchId
is clearly a @unique and not a @id?Alexander Hupfer
06/05/2022, 5:38 PMAlexander Hupfer
06/05/2022, 5:40 PMManthan Mallikarjun
06/06/2022, 1:14 AMtags
table which holds a user id and label, and then a NotesTagsJoinTable
which takes a note id and a tag id? Or should I go simpler and just have a tags
table which holds the label, user id and note id?Jon
06/06/2022, 4:11 AMposts.findMany
gets them all, but I also need to show them by list, lists.findUnique({where: listId, include: posts})
This all works fine. I'm trying to implement a custom ordering of posts within each list, however. So listId: 1
returns postId: 1, postId: 2
and listId: 2
returns postId: 2, postId: 1
- this is over-simplified, but shows the behavior I'm after.
I can't really store it on the post
itself, as it's shared, so I think I may need to store it on the list
but I'm not sure how it can be stored in a way that it can be sorted by.
Any ideas how I can achieve this custom ordering of the same related data?Keshav Tangri
06/06/2022, 12:06 PMStephan Du Toit
06/06/2022, 2:35 PMconst packages = await prisma.services.groupBy({
by: ["product"],
where: {
Status: true,
},
_count: {
product: true,
},
});
console.log("Packages", packages);
Results:
Packages [
{ _count: { product: 153 }, product: '5f147ee6770c7325aab150ce' },
{ _count: { product: 42 }, product: '5f147edd770c7325aab150cd' },
{ _count: { product: 80 }, product: '5f147f00770c7325aab150d0' },
{ _count: { product: 4 }, product: '5f147ecb770c7325aab150cc' },
{ _count: { product: 5 }, product: '5f147f0d770c7325aab150d1' },
{ _count: { product: 157 }, product: '5f147ef3770c7325aab150cf' }
]
The product value returns the id
instead of the actual record from related document / table. Is there a way to return the documents for products
in the same prisma query?Vladi Stevanovic
prisma chobo
06/06/2022, 5:17 PMprisma chobo
06/06/2022, 5:17 PMAlexander Hupfer
06/06/2022, 7:24 PMHalvor
06/06/2022, 9:16 PMmodel UserHash {
user User @relation(fields: [userId], references: [id])
userId Int
platform Platform @default(PC)
hash String
@@id(fields: [userId, platform])
@@unique(fields: [platform, hash])
}
Error:
Invalid `prisma.userHash.upsert()` invocation:
An operation failed because it depends on one or more records that were required but not found. No 'User' record(s) (needed to inline the relation on 'UserHash' record(s)) was found for a nested connect on one-to-many relation 'UserToUserHash'.
femzy
06/06/2022, 9:21 PMbio
to not null
model Profile {
id Int @id @default(autoincrement())
bio String @db.Text
city String @db.VarChar(255)
}
Manuel Galván
06/07/2022, 2:54 AMLuisfer
06/07/2022, 3:08 AMCOMMENT
as a comment in the prisma schema?Nilay Kothari
06/07/2022, 5:32 AM18 minutes
to release active connection.
• can someone guide or explain this behavior?
• According to me once query is executed, it should release connection
Note: Using 3.14.0 versionRhiannon Williams
06/07/2022, 7:18 AMAarav Shah
06/07/2022, 8:41 AMMykyta Machekhin
06/07/2022, 11:44 AMKIM SEI HOON
06/07/2022, 12:21 PMRichard
06/07/2022, 1:53 PMsagar lama
06/07/2022, 5:45 PMEkansh Vinaik
06/07/2022, 6:46 PMschema.prisma
in the .zip package generated
we’re using packages.individually=true
, packages.pattern=./schema.prisma
. Using those, the output is like:
lambda.zip
expanded:
• schema.prisma
• subfolder/
◦ sub subfolder/
▪︎ index.js
▪︎ index.js.map
and I get an error that schema.prisma
isn’t found in sub subfolder
. any way to include that schema.prisma
file down there/does anyone know what the best way to include .prisma
files is here? we’re using serverless-esbuild
+ seedVyrek XD
06/07/2022, 9:49 PMRahul Taing
06/07/2022, 10:15 PM.env
file instead of what is mentioned here. some way to provide the updated dotenv config path to the prisma client. something like this:
dotenv.config({
path: path.resolve('./my/custom/env/config/path'),
});
Gelo
06/08/2022, 7:15 AM{some-property: {equals: some-data}} to {some-property: some-data}
which is better?Oscar Stahlberg
06/08/2022, 8:38 AMBastien Etienne
06/08/2022, 8:54 AMconst updateUser = await prisma.cibest_user.upsert({
where: {
email: props.email,
},
update:{
tokens:{
//date_updated: new Date()
type_token: props.type_token
}
},
create:{
tokens : {
type_token : props.type_token,
refresh_token: accessToken.refreshToken,
valid: true,
expiration: expiration,
}
}
});