Kenny
04/27/2022, 4:53 PMconst test = await prisma.user.findMany();
i don't have any type inference, and i can just type 'test' as anything i want. Is there something i can do so functions like this do type inference out of the box? I just have the "getting started" project, although it's in an express project and inside a mono-repository, so it might be an issue with our setup, or if i can't find the good page of the documentation. Thanks for any help!Om Ray
04/27/2022, 5:14 PMuser
04/27/2022, 7:00 PMMubarak Shabel
04/27/2022, 8:37 PMMubarak Shabel
04/27/2022, 8:38 PMMubarak Shabel
04/27/2022, 8:41 PMfriebetill
04/27/2022, 10:19 PM# To reduce the image size we use a multi-stage build approach, see <https://bit.ly/3vMZjNu>.
### First stage ###
FROM node:lts AS builder
RUN apt-get install -y curl openssl
WORKDIR /app
COPY ./yarn.lock ./package.json ./
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn prisma:generate
RUN yarn build
RUN npm prune --production
####################
### Second stage ###
FROM alpine:3.14.0
RUN apk add --update nodejs
RUN addgroup -S node && adduser -S node -G node
USER node
WORKDIR /home/node/app
COPY --from=builder --chown=node:node /app ./
EXPOSE 3000
CMD ["node", "dist/src/main.js"]
The error message is:
UnhandledPromiseRejectionWarning: Error: Unknown PRISMA_QUERY_ENGINE_LIBRARY undefined. Possible binaryTargets: darwin, darwin-arm64, debian-openssl-1.0.x, debian-openssl-1.1.x, rhel-openssl-1.0.x, rhel-openssl-1.1.x, linux-arm64-openssl-1.1.x, linux-arm64-openssl-1.0.x, linux-arm-openssl-1.1.x, linux-arm-openssl-1.0.x, linux-musl, linux-nixos, windows, freebsd11, freebsd12, openbsd, netbsd, arm, native or a path to the query engine library.
You may have to run prisma generate for your changes to take effect.
at Object.getPlatform (/home/node/app/node_modules/@prisma/client/runtime/index.js:36103:13)
at async Object.instantiateLibrary (/home/node/app/node_modules/@prisma/client/runtime/index.js:36094:21)
But I have already tried setting binaryTargets
to different values, e.g. debian-openssl-1.1.x
for ubuntu 20.04 Unfortunately, nothing helped. Does anyone have a tip?user
04/27/2022, 11:38 PMAvi Block
04/28/2022, 7:31 AMconst usersWithCount = await prisma.user.findMany({
select: {
_count: {
select: { posts: true },
},
},
})
this code example from the docs gets the post count for each user
how would get, lets say, the count of published posts?Szabi Hetei-Bako
04/28/2022, 7:31 AMuser
04/28/2022, 8:08 AMever0de
04/28/2022, 8:24 AMuser
04/28/2022, 8:30 AMShivam Singh
04/28/2022, 9:55 AMprisma.create
on this model do I need to provide both createdBy
and owner
or either of them?Paul
04/28/2022, 10:06 AMselect id, name, "categoryId", a."createdAt" from forum_post fp
inner join (select "postId", max("createdAt") as "createdAt" from forum_post_reply group by "postId") a on a."postId" = fp.id
order by a."createdAt" desc;
ThanksVictor
04/28/2022, 11:23 AMmaxWait
and timeout
to support this case. However, I read that you should "*use interactive transactions with caution",* which is why I'm reaching out to you guys.
Is it fine for me to set maxWait
and timeout
to higher values given the fact that this operation will occur quite rarely?
For context I'm on a serverless environment with Vercel, and using PlanetScale for the database.daemon
04/28/2022, 2:01 PMdaemon
04/28/2022, 2:01 PMdaemon
04/28/2022, 2:21 PMObject[ ]
with a unique field identifier
and the column you want to update with the new value?daemon
04/28/2022, 2:23 PMZB
04/28/2022, 2:28 PMZB
04/28/2022, 2:29 PMChris Bitoy
04/28/2022, 3:28 PMnpx prisma studio
right after updating some fields in my model.schema
file. The error says:
Message: Error in Prisma Client request:
Could not parse URL of the datasource
Query:
{
"modelName": "User",
"operation": "findMany",
"args": {
"take": 100,
"skip": 0,
"select": {
"id": true,
"name": true,
"email": true,
"image": true,
"emailVerified": true,
"Role": true,
"accounts": true,
"profile": true,
"Program": true,
"sessions": true,
"profileId": true,
"Announcement": true,
"announcementId": true
}
}
}
//.env (data proxy setup)
MIGRATE_DATABASE_URL='<postgresql://me>...'
DATABASE_URL='<prisma://aws-us-east>...'
Steps to recreate error:
1. Updated schema file
2. Ran npx prisma db push
3. Ran npx prisma studio
Can you please help resolve?Chris Gurba
04/28/2022, 10:08 PMCREATE TABLE color (
color_id INT GENERATED BY DEFAULT AS IDENTITY
(START WITH 10 INCREMENT BY 10), // <- this column
color_name VARCHAR NOT NULL
);
Trieu Le
04/29/2022, 12:33 AMmodel User {
id String @id @default(cuid())
name String
}
model Chat {
id String @id @default(cuid())
user_id String
user User @relation(fields: [user_id], references: [id])
to_user_id String
to_user User @relation(fields: [to_user_id], references: [id], name: "toUser")
created_at DateTime @default(now())
updated_at DateTime @updatedAt
}
hi how can I define a model chat relation to User . but i don't want User have reference to ChatSeren_Modz 21
04/29/2022, 3:35 AMmuhajir
04/29/2022, 4:12 AMuser
04/29/2022, 8:31 AMuser
04/29/2022, 9:20 AMJames
04/29/2022, 11:35 AM