Callum
02/16/2022, 7:57 AMCoditoiu Mihai
02/16/2022, 8:55 AMQuery createOneEvent is required to return data, but found no record(s)
after about 10 inserts into db and then I have to restart the server.
I am using prisma 2(3.9.2) with MySql. Does anybody knows what can be the problem? The error occurrs only on Heroku, on may local machine is working welluser
02/16/2022, 10:13 AMuser
02/16/2022, 10:15 AMTomáš Průha
02/16/2022, 1:07 PMKelly Copley
02/16/2022, 1:39 PMOmar Khairy
02/16/2022, 5:26 PMJuan Gabriel Palarpalar
02/16/2022, 5:39 PMPreferences {
id
...
}
Clients {
id
...
}
clientPreferences {
id
clientId
preferenceId
}
Now, a preference can be attached/detached to multiple clients. My question is how will I update existing record in clientPreferences
and at the same time, add a record if it doesn’t exist? My HTTP endpoint for this is
PATCH /preferences/:id
with the JSON request body of
{
"clientIds": [
1,
2,
3
]
}
Juan Gabriel Palarpalar
02/16/2022, 5:39 PMJohn McElreavey
02/16/2022, 6:48 PMwhere: {
outcome: {
OR: [
{
state: undefined,
},
{
state: MatchOutcomeState.POSITION_ACCEPTED,
},
{
state: MatchOutcomeState.POSITION_UNDER_OFFER,
},
],
},
}
Basically I want all records where there is no outcome record or if there is I want it in a specific state.Kelly Copley
02/16/2022, 7:09 PMKelly Copley
02/16/2022, 7:12 PMSam Lambert
02/16/2022, 7:28 PMKelly Copley
02/16/2022, 7:32 PMShmuel
02/16/2022, 7:55 PMwhere
block, similar to laravel's when()
function.
https://laravel.com/docs/8.x/queries#conditional-clausesMichael Aubry
02/16/2022, 11:28 PMJonathan Marbutt
02/17/2022, 3:06 AMkhareta
02/17/2022, 8:17 AMKay Khan
02/17/2022, 9:50 AMexport type authentication_with_all_includes {
...
user: user,
authentication_permission: authentication_permission[]
}
sagar lama
02/17/2022, 10:44 AMmodel User {
...
degree_levels UserDegreeLevels[]
}
model DegreeLevel {
...
users User[]
}
model UserDegreeLevels {
id Int @id @default(autoincrement())
degree_level DegreeLevel @relation(fields: [degreeId], references: [id], onDelete: Cascade)
degreeId Int
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int
created_at DateTime @default(now())
updated_at DateTime @updatedAt
}
When i execute the following query,
const user = await this.prismaService.user.findFirst({
where: { id },
include: {
degree_levels: true,
},
});
I get
{
id: 5,
...
degree_levels: [
{
id: 1,
uuid: '1cca9b39-af0b-4219-a951-93f205fab67f',
degreeId: 10,
userId: 5,
created_at: 2022-02-17T09:00:52.024Z,
updated_at: 2022-02-17T09:00:52.025Z
},
{
id: 2,
uuid: '709ee342-e6d5-4e49-8d23-6339cf0fb0d6',
degreeId: 11,
userId: 5,
created_at: 2022-02-17T09:00:52.024Z,
updated_at: 2022-02-17T09:00:52.025Z
}
]
}
The result I want
{
id: 5,
...
degree_levels: [
DegreeLevel1, # values of degree level model
DegreeLevel2
]
}
Elijah Rosier
02/17/2022, 10:45 AM@default(now())
? We running jest tests against the database and want to ensure the correct dates are being inserted, and don't want brittle tests.Manu Rodgers
02/17/2022, 11:17 AMGeebrox
02/17/2022, 12:11 PMdatasource
and generator
configs and other files where I describe only `model`s. My schema file becomes to large and it is hard to maintain everything in one fileben
02/17/2022, 5:07 PMawait prismaClient.$executeRaw(
Prisma.sql`CREATE DATABASE ${databaseId} TEMPLATE ${templateName};`
);
on postgres, getting STATEMENT: CREATE DATABASE $1 TEMPLATE $2;
through on the DB sideGabriele Palmiotto
02/17/2022, 7:40 PMJoshua Ramin
02/18/2022, 7:13 AMsagar lama
02/18/2022, 7:18 AMmodel Post {
id Int @id @default(autoincrement())
title String
categories CategoriesOnPosts[]
}
model Category {
id Int @id @default(autoincrement())
name String
posts CategoriesOnPosts[]
}
model CategoriesOnPosts {
post Post @relation(fields: [postId], references: [id])
postId Int
category Category @relation(fields: [categoryId], references: [id])
categoryId Int
assignedAt DateTime @default(now())
assignedBy String
@@id([postId, categoryId])
}
Typescript is giving me an error when I try the following,
jest.spyOn(<http://prisma.post|prisma.post>, 'findFirst').mockResolvedValue({
...mockPost,
categories: [...mockCategories],
});
Eko Nur Arifin
02/18/2022, 9:26 AMSreenivas Dunna
02/18/2022, 12:20 PMOnkel Tem
02/18/2022, 12:38 PM