Victor Meireles
01/02/2022, 6:09 PMVictor Meireles
01/02/2022, 6:55 PMJonathan Gamble
01/02/2022, 9:14 PMezeikel
01/02/2022, 10:52 PMUncheckedCreate
type is .e.g PaymentUncheckedCreateWithoutPeriodInput
where Payment
and Period
are models in my schema?Neo Lambada
01/03/2022, 8:27 AMmodel User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @db.DateTime(0)
updatedAt DateTime @default(now()) @db.DateTime(0)
//relationships
followedBy FollowUser[] @relation("follower")
following FollowUser[] @relation("following")
}
model FollowUser {
id Int @id @default(autoincrement())
followerId Int
followingId Int
createdAt DateTime @default(now()) @db.DateTime(0)
updatedAt DateTime @default(now()) @db.DateTime(0)
//relationships
follower User @relation("follower", fields: [followerId], references: [id])
following User @relation("following", fields: [followingId], references: [id])
// @@id([followerId, followingId])
}
Neo Lambada
01/03/2022, 8:28 AMNeo Lambada
01/03/2022, 8:28 AMconst user = await prisma.user.findMany({
where: {
id: 46,
},
include: {
followers: true,
},
take: args.limit || undefined,
skip: args.offset || undefined,
}) This gives me the user with his followers as an array. can all the followers for a given user be retrieved?
Maxence Lecanu
01/03/2022, 9:16 AMArshath
01/03/2022, 10:11 AMPrisma is not Initialized
or Something.
Anything am doing wrong?Ignace Mella
01/03/2022, 11:40 AMDaniell
01/03/2022, 2:51 PMezeikel
01/03/2022, 10:15 PM.update()
that needs to use the updated list of subscribers
for example in the nested write to make a calculation.
Is there any way to access the updated list of subscribers
including the id
of newly created subscribers for an update that hasn't finished executing yet?Robert Fish
01/04/2022, 4:07 AMVilke
01/04/2022, 6:51 AMobject
("[object Date]") cannot be serialized as JSON. Please only return JSON serializable data types.Vilke
01/04/2022, 6:53 AMVilke
01/04/2022, 6:54 AMToru Eguchi
01/04/2022, 10:19 AMmodel User {
id Int @id @default(autoincrement())
name String?
children FamilyRelation[] @relation("child")
parents FamilyRelation[] @relation("parent")
}
model FamilyRelation {
child User @relation("child", fields: [childId], references: [id])
childId Int
parent User @relation("parent", fields: [parentId], references: [id])
parentId Int
@@id([parentId, childId])
}
Now I want to query users who has ancestors named “John”.
user
id | name | parent_user_id | child_user_id
1 | "John" | [] | [2, 4]
2 | "A" | [1] | []
3 | "B" | [4] | []
4 | "C" | [1] | [4]
5 | "D" | [] | []
→ query result should be "A", "B", "C".
Astral Gaming
01/04/2022, 1:32 PMDaniel
01/04/2022, 2:23 PMStatement Mode: Most aggressive method. This is transaction pooling with a twist: Multi-statement transactions are disallowed. This is meant to enforce "autocommit" mode on the client, mostly targeted at PL/Proxy.
Wondering if you can use any of the two with prismaDemian N
01/04/2022, 4:50 PMChris Tsongas
01/04/2022, 5:57 PMts-node
processes for cron jobs or seeding the database, the app crashes apparently running out of memory:
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xb00d90 node::Abort() [/app/.heroku/node/bin/node]
2: 0xa1823b node::FatalError(char const*, char const*) [/app/.heroku/node/bin/node]
3: 0xcedbce v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/app/.heroku/node/bin/node]
4: 0xcedf47 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/app/.heroku/node/bin/node]
5: 0xea6105 [/app/.heroku/node/bin/node]
6: 0xea6be6 [/app/.heroku/node/bin/node]
7: 0xeb4b1e [/app/.heroku/node/bin/node]
8: 0xeb5560 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/app/.heroku/node/bin/node]
9: 0xeb84de v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/app/.heroku/node/bin/node]
10: 0xe7990a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/app/.heroku/node/bin/node]
11: 0x11f2f06 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/app/.heroku/node/bin/node]
12: 0x15e7819 [/app/.heroku/node/bin/node]
Aborted
error Command failed with exit code 134.
I bumped up our Heroku dyno from 512MB of RAM to a Standard 2X with 1GB for $50/month, but still crashes. To get more RAM, I'd have to go with a Performance M dyno for $250/month, which is not affordable especially given I'll need three environments (test, staging, and production). Wondering if anyone else has run into this problem?Chris Tsongas
01/04/2022, 8:22 PMts-node
since when deploying the server application that's working, TS gets compiled during the build step and the start command called by Heroku is just running node
not ts-node
.Shmuel
01/04/2022, 8:23 PMawait prisma.role.update({
where: { id: 1 },
data: {
users: {
create: [
{ user: { connect: { id: 1 } } },
{ user: { connect: { id: 2 } } },
{ user: { connect: { id: 3 } } },
]
}
}
})
How would I remove records from a many to many?
I can do it like this...
await prisma.role.update({
where: { id: 1 },
data: {
users: {
deleteMany: [
{ user_id: 1 },
{ user_id: 2 },
{ user_id: 3 },
]
}
}
})
But is there a similar way of doing it like the first example just with disconnect
?Luke Morris
01/04/2022, 9:38 PMLuke Morris
01/04/2022, 9:38 PMLuke Morris
01/04/2022, 9:44 PMburaks
01/04/2022, 10:26 PMFranco Roura
01/05/2022, 12:01 AMprimsa migrate deploy
after the rollout of the pods.
Before allowing users to consume the new pods of the API, ECS checks if these are healthy, in order to do that I usually define a simple endpoint at /api/health_check
that returns 200 OK.
Now, ideally the new pods shouldn't be considered "healthy" until their prisma client matches the deployed DB schema, is there a way to "health test" prisma inside my health check endpoint?user
01/05/2022, 8:00 AM