Adrian
07/25/2022, 12:29 PMVicente Matus
07/25/2022, 5:06 PMError: P1001
`Can't reach database server at `cluster0...`:`27019``
`Please make sure your database server is running at `cluster0...`:`27019`.`
Whenever i try to use npx prisma db pull
in an existing MongoDB data base
This is my DATABASE_URL
mongodb+srv://<username>:<password>@<cluster>/<database>?retryWrites=true&w=majority
I'm currently connected to MongoDB Atlas, and the cluster is allowing connections from all ip's. How can i solve this?Yunbo
07/25/2022, 5:49 PMconst u = await prisma.user.create({
data: {
email: '<mailto:emma@prisma.io|emma@prisma.io>',
posts: {
create: [
{
title: 'My first post',
external_user_id: `a1b2c34d-{user.id}`
}
],
},
},
})
about external_user_id
, so how can i get user.id (that is being created in this query) dynamically?Matt Mueller (Prisma Client PM)
Mordechai Tzarfati
07/25/2022, 9:47 PMDamon J. Murray
07/25/2022, 10:14 PMStringFilter
type from prisma's deep input types? Am I forced to duplicate this type in my consuming project?Michael Jay
07/26/2022, 12:56 AMprisma.contact.createMany({
data: [
{
...contact attrs,
tags: {
create: {...}
}
}
]
})
and so forth. But it looks like that's only possible for create.
so I'm guessing my two options are:
1. CreateMany the contacts, then match them back up with the input to get the right ID on the related records
2. Create (single) each contact with its related records in place. Maybe in a transaction/ Promise all.
Am I missing something - are those my two options?mahmood sagharjooghi
07/26/2022, 2:54 AMYunbo
07/26/2022, 3:25 AMaccntId : 1, regionId: 1
this.prisma.cidrBlock.findFirst({
where: {
vpcs: {
none: {
account_id: accntId,
region_id: regionId,
},
},
},
orderBy: {
id: 'asc',
},
});
Jannik Köster
07/26/2022, 8:15 AMMordechai Tzarfati
07/26/2022, 1:19 PMid
to the object, any way to avoid it?Al
07/26/2022, 1:28 PMPaul Obayuwana
07/26/2022, 2:36 PMmembers
and manager
in model Community
both refer to User
. Please provide different relation names for them by adding `@relation(<name>).
How do I go about this? Am new to prisma. I haven't understood the docs fullyThomas Yankue
07/26/2022, 2:48 PMmodel User {
id String @id
username String @unique
}
And basically I want to tie together 2 users. Similar to just about every other app with a friends system, each user can have multiple friendships, but each friendship can only include 2 users. What is the best way to do this in Prisma with MySQL, in a way that I can easily list all friends of a given user? Thanks!Thomas Yankue
07/26/2022, 2:50 PMfriendship
model that had an array of user IDs, or an array of users, but the problem was to fetch all of user A's friends, I could easily get all the IDs, but then I had to perform 1 query for each friend to fetch the whole user model. It worked but it seemed very inefficient - is there a better way or is this the only way it can work?Viggo Jonasson
07/26/2022, 6:37 PMmodel TestUser {
id String @id @default(cuid()) @unique
name String
madeReviews Review[]
receivedReviews Review[]
}
model TestReview {
id String @id @default(cuid()) @unique
author TestUser @relation(_fields_: [authorId], _references_: [id])
authorId String
receiver TestUser @relation(_fields_: [receiverId], _references_: [id])
receiverId String
rating Int
comment String
}
I basically just want to have a user that can make and get reviews.Khelil Benosman
07/26/2022, 6:44 PMKJReactor
07/26/2022, 7:15 PMinclude
.Pieter
07/26/2022, 8:23 PMAngel
07/26/2022, 10:45 PMnpx prisma generate
? I usually migrate my schemas using npx prisma migrate [...]
, which I think also regenerates the Prisma Client, so what are other use cases for npx prisma generate
?João Vitor Casarin
07/26/2022, 11:03 PMTRUNCATE TABLE user RESTART IDENTITY CASCADE;
... everytime I try to run that on both prisma.$queryRaw
and on pgadmin I get the same error: 42601 syntax error at or near to "user"João Vitor Casarin
07/26/2022, 11:03 PMuser
07/27/2022, 8:00 AMPaul Obayuwana
07/27/2022, 1:24 PMMichael Jay
07/27/2022, 2:22 PMMichael Buller
07/27/2022, 2:47 PMDrift detected: Your database schema is not in sync with your migration history.
The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.
It should be understood as the set of changes to get from the expected schema to the actual schema.
[+] Added tables
- stage UserRole
? We need to reset the database.
Do you want to continue? All data will be lost. » (y/N)
Is there a way to tell Prisma to ignore a schema ?
Michael Buller
07/27/2022, 2:48 PMIsaac Spiegel
07/27/2022, 5:22 PMexport function paginatedFindMany<K>(
delegate: PrismaDelegate<K>,
where: PrismaWhereInput<K>,
select ...
) {
...
}
It doesn’t look like the client exposes the interfaces needed to type this fully, I’m wondering if there’s another Prisma package or community generator that’s implemented these sorts of generic interfacesDave Edelhart
07/27/2022, 6:25 PMDave Edelhart
07/27/2022, 6:35 PM