Topi Pihko
03/30/2022, 2:39 PMasync getFactories(enterpriseId: number): Promise<Factory[]> {
return (
await this.prisma.enterprise.findFirst({
where: {
id: enterpriseId,
},
include: {
site: {
include: {
factory: true,
},
},
},
})
).site
.map((site) => {
return site.factory;
})
.flat();
}
Mischa
03/30/2022, 3:37 PMMischa
03/30/2022, 3:42 PMMischa
03/30/2022, 4:05 PMBenny Kachanovsky
03/30/2022, 4:39 PMwebsearch_to_tsquery
(Postgres) search function instead of to_tsvector
using Prisma?Ryan Westlake
03/30/2022, 8:30 PMimport Prisma, { PrismaClient } from "@prisma/client";)
?jdkdev
03/30/2022, 11:58 PMTorrino
03/31/2022, 8:36 AMalexinfurs
03/31/2022, 8:42 AMIgnace Mella
03/31/2022, 9:34 AMmodel User {
id Int @id @default(autoincrement())
name String?
followedBy User[] @relation("UserFollows", references: [id])
following User[] @relation("UserFollows", references: [id])
}
Hi people, I found this part on the documentation, but I don't really get how I can just simply let a User follow and unfollow a User. What does the code have to look like?Alexey Murz Korepov
03/31/2022, 10:10 AMschema.prisma
file from several ENV variables? Something like this:
datasource db {
provider = "postgresql"
url = "postgresql://$DB_USERNAME:$DB_PASSWORD@localhost:5432/$DB_NAME"
}
louis-sanna-eki
03/31/2022, 10:11 AM<mongodb://localhost:27017/>
fails.
Connection code (it works with a mongoAtlas db):
const prisma = new PrismaClient({ datasources: { db: { url } } });
await prisma.$connect();
I'm getting errors:
Error parsing connection string: Database must be defined in the connection string
I'm must be missing something obvious, thx for your help.Kharann
03/31/2022, 12:33 PMmodel User
is mapped to PrismaUser
rather than User. It clashes with my typings and i want an easier DX of importing typesSaulo Aguiar
03/31/2022, 6:31 PMprisma migrate dev
.
However, when I try to re create the database from scratch in my CI server, I get the following error:
Database error:
ERROR: relation "patient_unique_id_seq" does not exist
I retrieved a dump from the production-ready database, and I saw that this sequence is properly defined in there.
But it looks like the prisma introspection - and the migration it generated - is missing it.
Any suggestions on how to fix this?Eme Muñoz
04/01/2022, 4:49 AMtry {
await db.category.create({ data: fields })
return json({ success: true })
} catch (error) {
return badRequest({
type: typeof error,
instance: error.constructor.name,
constructorName: Prisma.PrismaClientKnownRequestError.name,
isInstance: error instanceof Prisma.PrismaClientKnownRequestError,
})
// if (error instanceof Prisma.PrismaClientKnownRequestError) {
// if (error.code === 'P2002') {
// return badRequest('Category already exists')
// }
// }
// return badRequest(error.message)
}
But the operation error instance of Prisma.PrismaClientKnownRequestError
returns false
Anyone know what I could be missing?
The response I'm getting:
constructorName: "PrismaClientKnownRequestError"
instance: "PrismaClientKnownRequestError"
isInstance: false
type: "object"
Marvin
04/01/2022, 8:11 AMuuid
with postgres, should I always define the db type as String
+ @db.Uuid
? I only have String
currently and I'm not sure if prisma stores the uuid as native uuid by default?aetheryx
04/01/2022, 12:07 PMClemo
04/01/2022, 1:58 PMError: Migration engine error: Error querying the database: Unknown authentication plugin sha256_password
Brendan Allan
04/01/2022, 2:37 PMimira
04/01/2022, 3:12 PMprisma://..
connection string. The underlaying database is Heroku Hoby basic plan (20 connections). Everything should be ready to serverless environment but I keep receiving this error:
Error: Invalid prisma.nearDailyStats.findFirst() invocation: 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: 3) (edited)
[4:35 PM] any idea what's the problem? Thank youOrcioly Andrade Alves
04/01/2022, 3:43 PMGreg Ederer
04/01/2022, 7:11 PMPerson
can have an Address
, there's no address
property on the generated Person
type. Do I need to define my own type here, or is there a Prismaish way to handle this?Jannik Köster
04/02/2022, 1:46 AMWilly Konlack
04/03/2022, 12:44 AMphil2srass
04/04/2022, 9:14 AMphil2srass
04/04/2022, 9:14 AMThis IsMe
04/04/2022, 9:27 AMMoonchild Everlasting
04/04/2022, 10:35 AMMoonchild Everlasting
04/04/2022, 10:35 AMMichael Roberts
04/04/2022, 11:21 AM