Lee
05/10/2022, 11:07 AMGraphQLError: Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 30)Has anyone seen this error before? Weโre currently being haunted by it, and have tried tweaking connection limits/timeouts/adding pgbouncer/throttling concurrent DB access/nearly everything we can think of and no success ๐ฅฒ
Julian
05/10/2022, 11:26 AMdecimal
in the database without using floats or returning a Decimal.js instance?
I just want to store pricing information, but floats can be unprecise and Decimal.js objects are a hassle to work withLeonard Filip
05/10/2022, 11:52 AMmodel Author {
...
post Post?
}
// to
model Author {
...
post Post[]
}
I know I should also pluralise the relation field to posts
but is this normal behaviour?Joe
05/10/2022, 12:04 PMError: Cannot find module '@prisma/client'
Iโm using the commands:
npx prisma migrate reset --preview-feature
npx prisma migrate dev --name init --preview-feature
npx prisma generate
Mischa
05/10/2022, 4:25 PMJason Kleinberg
05/10/2022, 4:40 PMCOUNT
in the improved raw queries? It seems to be throwing with this message:
Int cannot represent non-integer value: 0
(Note that the 0 in this case is the count, but I get the same error with other values)Jason Kleinberg
05/10/2022, 4:53 PMbidint
. This is an Apollo issue.aetheryx
05/10/2022, 4:56 PMCREATE INDEX ON table_name((column_name->>'json_prop')) USING GIN (column_name);
-- ^ looking for this behavior
Yaakov
05/10/2022, 7:05 PMconst order = 'last_name ASC, first_name ASC';
await prisma.$queryRaw`SELECT *
FROM users
ORDER BY ${order}`;
I'm getting this error
`Raw query failed. Code: 1008
. Message: `The SELECT item identified by the ORDER BY number 1 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name.``
Using SQL ServerMathie
05/10/2022, 9:55 PMawait this.client.modlogsService.createModlogs({
user: {
connect: {
userId: user.id
}
},
type: "WARN",
date: new Date(),
moderator: interaction.user.tag,
reason: reason
});
I want to create the user (user
) if not existSam Weiss
05/10/2022, 10:52 PMreferId
, `userId`: 1 to 1, and `referredUserId`: 1 to many.
model Referral {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
referId String // Auto Generate Random String
userId Int @unique
user User @relation(fields: [userId], references: [id])
referredUsersId Int[]
referredUsers User[] @relation(fields: [referredUsersId], references: [id])
}
I'm not sure exactly how to reference these in the User model. I tried
Referral Referral?
UsersReferred Referral[]
But I get an error
Error validating model "User": Ambiguous relation detectedWhat's the correct way to model a referral table and how can I do it in prisma?
shahrukh ahmed
05/11/2022, 7:53 AMid
of the user as well as the uuid
.
model User {
id Int @id @default(autoincrement())
uuid String @default(cuid())
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
author User @relation(fields: [authorId], references: [id])
authorId Int
}
I get all the posts by authorId by this. How can I do something similar also with UUID?
const event = await prisma.posts.findMany({
where: {
authorId: 1
}
});
jeho Ntanda
05/11/2022, 9:34 AMjeho Ntanda
05/11/2022, 9:35 AMjeho Ntanda
05/11/2022, 9:39 AMerror - Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>
is an error am getting in a nextjs app, but i dont know itaetheryx
05/11/2022, 10:33 AMqueryRaw
issues and the Prisma Studio bugs - now that queryRaw
is fixed, we're just waiting on these ๐
https://github.com/prisma/studio/issues/816Marvin
05/11/2022, 10:50 AMconfig
json for the frontend). I want to track analytics (button clicks, hovers, views) of the elements. Would I store it as simple JSON in the model field called analytics
for example? Can updates collide when incrementing a count for example?
I would love to hear your feedback on this because I want to have it in the same database (no separate service beside the postgres database). ๐Alban Kaperi
05/11/2022, 11:04 AMAlban Kaperi
05/11/2022, 11:13 AMconst customerData: Prisma.CustomerCreateInput[] = [
{
name: 'Alice',
surname: 'Kaperi',
email: '<mailto:alice@prisma.io|alice@prisma.io>',
products: {
create: [
{
title: 'Apples',
description: 'These are juicy apples',
price: 12.5,
},
],
},
},
]
my schema has the following:
model Customer {
id Int @id @default(autoincrement())
email String @unique
name String?
surname String?
phone String?
code String @unique
total_sale Float
total_quantity Int
points Int
address String
products Product[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Product {
id Int @id @default(autoincrement())
title String
description String?
size String?
qty Int? @default(0)
cost Float
price Float
upc Int
reorder_point Int
manufactuerer String
last_received DateTime @default(now())
picture String
customer Customer? @relation(fields: [customerId], references: [id])
customerId Int?
department Department? @relation(fields: [departmentId], references: [id])
departmentId Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
user
05/11/2022, 1:00 PMRichard
05/11/2022, 2:02 PMrejectOnNotFound
to which of the provided where conditions makes the query return null
? (see screenshot with code)Andrew Leung
05/11/2022, 7:13 PMJunior-Web-Dev
05/12/2022, 2:29 AMawait prisma.$queryRawUnsafe`UPDATE table SET template_json_data = jsonb_set(template_json_data, '{namingConvention}', '"${String(req.body.projectName)}"', false) WHERE save_id = ${Number(req.body.saveId)}`;
y0on2q
05/12/2022, 3:57 AMawait this.prismaService.customer.create({
data: {
name: 'hello',
email: '<mailto:ltnscp9028@gmail.com|ltnscp9028@gmail.com>',
password: 'password',
},
});
Code create this query.Julian Tosun
05/12/2022, 6:46 AMAarav Shah
05/12/2022, 7:45 AMkyohei
05/12/2022, 8:45 AMimprovedQueryRaw
and it works localy, but on Vercel it shows ERROR Error: error: The preview feature "improvedQueryRaw" is not known
. Is there any case possible for 3.14 cannot recognize this flag?Martin Pinnau
05/12/2022, 11:35 AMtype EmailMessage { .... error: Model declarations have to be indicated with the `model` keyword`
same error also for EmailSubject
my schema:
model Email {
id String @id @map("_id") @db.ObjectId
name String @unique
emailMessage EmailMessage
emailSubject EmailSubject
receiverGroup Receiver[]
isActivated Boolean @default(value: true)
role String
btnName String
}
type EmailMessage {
id String
messageDe String
messageEn String
}
type EmailSubject {
id String
subjectDe String
subjectEn String
}
type Receiver {
id String
email String
firstName String
lastName String
}
What am I doing wrong regarding these embedded documents ?
Is there support for embedded document lists but not for embedded documents ?Niklas
05/12/2022, 1:25 PM"Can't reach database server at `<http://ec2-3-68-54-65.eu-central-1.compute.amazonaws.com|ec2-3-68-54-65.eu-central-1.compute.amazonaws.com>`:`5432`
Please make sure your database server is running at `<http://ec2-3-68-54-65.eu-central-1.compute.amazonaws.com|ec2-3-68-54-65.eu-central-1.compute.amazonaws.com>`:`5432`.
\",\"stack\":\"Error: Can't reach database server at `<http://ec2-3-68-54-65.eu-central-1.compute.amazonaws.com|ec2-3-68-54-65.eu-central-1.compute.amazonaws.com>`:`5432`
Please make sure your database server is running at `<http://ec2-3-68-54-65.eu-central-1.compute.amazonaws.com|ec2-3-68-54-65.eu-central-1.compute.amazonaws.com>`:`5432`.
at Object.request (/app/node_modules/@prisma/client/runtime/index.js:45629:15)
at async PrismaClient._request (/app/node_modules/@prisma/client/runtime/index.js:46456:18)
at async getDataFromNestedQuery (/app/src/api/v3/nestedqueryendpoint/controller.js:228:24)\"}}"
1. When checking the backend-logs we noticed that Prisma runs a nested query instead of a JOIN query (a similar issue is mentioned in https://github.com/seromenho/prisma-join-performance). Can we change the generated queries to a JOIN query? Anybody faced a similar issue?
2. Does setting the connection_limit=1
help? Unfortunately in heroku we are unable to append it to the DATABASE_URL variable. Does anybody have experience with this?