jsoneaday
jsoneaday
Explore posts from servers
PPrisma
Created by jsoneaday on 10/31/2024 in #help-and-questions
Why is omit not available for this query?
I am using prisma 5.21.1. If I try this call omit is not available why?
client.profile.findFirst({
omit: {
password: true,
},
where: {
id: profileId,
},
});
client.profile.findFirst({
omit: {
password: true,
},
where: {
id: profileId,
},
});
8 replies
PPrisma
Created by jsoneaday on 9/9/2024 in #help-and-questions
Cursor based paging issue for multilevel relationships
I have this query. As you can see my paging field's like cursors are inside the select: works section. Question completes in the next post.
const works = await this.#client.follow.findMany({
select: {
followed: {
select: {
works: {
take: pageSize,
skip: lastCursor ? 1 : 0,
cursor: lastCursor
? {
id: lastCursor,
}
: undefined,
orderBy: {
id: SortOrder.Desc,
},
select: {
id: true,
updatedAt: true,
title: true,
description: true,
content: true,
authorId: true,
author: {
select: {
userName: true,
fullName: true,
description: true,
},
},
workTopics: {
select: {
topic: {
select: {
id: true,
name: true,
},
},
},
},
workLikes: {
select: {
id: true,
},
},
},
},
},
},
},
where: {
followerId,
},
});
const works = await this.#client.follow.findMany({
select: {
followed: {
select: {
works: {
take: pageSize,
skip: lastCursor ? 1 : 0,
cursor: lastCursor
? {
id: lastCursor,
}
: undefined,
orderBy: {
id: SortOrder.Desc,
},
select: {
id: true,
updatedAt: true,
title: true,
description: true,
content: true,
authorId: true,
author: {
select: {
userName: true,
fullName: true,
description: true,
},
},
workTopics: {
select: {
topic: {
select: {
id: true,
name: true,
},
},
},
},
workLikes: {
select: {
id: true,
},
},
},
},
},
},
},
where: {
followerId,
},
});
2 replies
PPrisma
Created by jsoneaday on 6/17/2024 in #help-and-questions
Docker error Can't reach database server at localhost:5432
I'm using docker compose and my server api depends on a postgres server in the same container. During the build I run
prisma migrate deploy
prisma migrate deploy
and get this error. I also tried replacing localhost with 0.0.0.0 and db (my database's docker service name) but it does not work. Strangely from my dev machine I'm able to run
prisma migrate dev --name init
prisma migrate dev --name init
without issue using this same DATABASE_URL variable.
DATABASE_URL="postgresql://freeauth:freeauth@localhost:5432/freeauth?schema=public"
DATABASE_URL="postgresql://freeauth:freeauth@localhost:5432/freeauth?schema=public"
5 replies