Akash
02/17/2021, 5:17 AMPascal Sthamer
02/18/2021, 1:33 PMconst queries = []
for (const somevar of somearray) {
const params = await someAsyncFunc(somevar)
queries.push(prisma.someQuery(optsWithParams))
}
await prisma.$transaction(queries)
The thing Im unsure about is that query 1 might be finished before calling prisma.$transaction because there are async operations required to generate the other queries.Tanmay Naik
02/22/2021, 6:59 AMAnders
03/01/2021, 4:47 PMconst updatedPostCount = await prisma.formInput.updateMany({
where: {
id: [
"49523f75-9ec5-471f-999a-62b8097cabcc",
"51272b87-9592-4121-83f8-a1471abcc540",
],
},
data: { name: "test mass" },
});
I get the following error
Argument id: Got invalid value
[
'49523f75-9ec5-471f-999a-62b8097cabcc',
'51272b87-9592-4121-83f8-a1471abcc540'
]
on prisma.updateManyFormInput. Provided List<UUID>, expected StringFilter or String.
type StringFilter {
equals?: String
in?: List<String>
notIn?: List<String>
lt?: String
lte?: String
gt?: String
gte?: String
contains?: String
startsWith?: String
endsWith?: String
not?: String | NestedStringFilter
}
any help would be greatAnders
03/01/2021, 4:49 PMShreyas Sreenivas
03/02/2021, 9:47 PMsakulstra
03/05/2021, 3:24 PMcreateMany
and was wondering if we might see the improvements proposed in https://github.com/prisma/prisma/issues/5437#issuecomment-772692381 are being considered to be pulled into the experimental mode? &/or as long as we don't how are you guys working around that issue 🤔
I got a cronjob batch upserting 50k docs and doing this sequentially seems like a rather bad idea - especially as i'm on serverless with function timeout-limits. I've now chunked it and process it with multiple lambdas, but that's a quite connection heavy approach.
Is $rawQuery the way to go?JY
03/15/2021, 6:10 AMTanmay Naik
03/15/2021, 10:12 AMmaxweld
03/16/2021, 1:36 PMBen
03/22/2021, 11:24 PMJeff Clark
04/04/2021, 3:54 PM$transaction
where you get a runtime error like this?
TypeError: Cannot assign to read only property '_transactionId' of object '#<NewPrismaClient>'
I have been trying to puzzle this out for 3 straight days and am at my wits end. I also asked yesterday on GH Discussions with more details: https://github.com/prisma/prisma/discussions/6395Shreyas Sreenivas
04/06/2021, 7:10 PMBen Ezard
04/12/2021, 10:43 PMnpx prisma migrate deploy
within a Jest global setup script, and it works locally but fails when running in GitHub Actions CI, saying
/usr/bin/env: 'node': No such file or directory
Command failed: npx prisma migrate deploy
No idea why it's happening since Node is definitely in the path, but being able to run migrations from code (e.g. prismaClient.runMigrations()
) would still be super useful for test setup
I imagine it'd probably be necessary to specify the path to the Prisma schema/migrations directory in case the current working directory doesn't include themNiko Guerra
04/15/2021, 1:24 AMInvalid response data: the query result was required, but an empty Object((Weak)) was returned instead.
This is when I'm executing .create()
statementsRintsi
04/16/2021, 3:51 PMNick
04/16/2021, 5:34 PMlocalhost:3000/api/graphql
to test my queries before implementing them. I’m using my Prisma schema definitions inside of my Apollo Server typeDefs/resolvers, and am running version 2.21.2
of @prisma/client and version 2.22.2
of apollo-server-micro.
I’m currently unable to get the new relation’s count feature working (meaning, the _count
option doesn’t appear in my GraphQL Playground queries), and have tried virtually every permutation I can think of. When I’m inside of a React component and am updating my gql query, the _count
option will autocomplete as I type, as if it’s being recognized, but upon saving my changes, the page breaks. It won’t autocomplete when I’m inside my GraphQL playground, however.
I have enabled the selectRelationCount
option in the generator portion of my schema.prisma
as the docs instruct, and ran yarn prisma generate
to ensure that my new client data is updated.
Here’s a simplified example with a User type that has many Posts:
typeDefs
type User {
id: Int!
email: String!
posts: [Post]
}
type Post {
id: Int!
title: String!
user: [User]
}
I can’t figure out why the following resolver won’t allow me to access the _count
data in my GraphQL Playground queries or within a gql query in a React component:
resolvers
allUsers: () => {
return prisma.user.findMany({
include: {
_count: {
select: {
posts: true,
},
},
posts: true,
},
});
},
This is my first time integrating Prisma with Apollo/Next.js so please let me know if I’m overlooking something super simple. Thanks!Mitchell Romney
04/18/2021, 4:18 PMRintsi
04/19/2021, 9:22 AMConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: FromSql(9), cause: Some(WrongType { postgres: Cidr, rust: "core::option::Option<std::net::ip::IpAddr>" }) }) })
Tanmay Naik
04/28/2021, 4:29 AMRintsi
04/29/2021, 8:02 AM@ResolveField()
async items(@Parent() asset: Asset, @Args('first') first: number) {
return this.prisma.asset.findUnique({ where: { id: asset.id } }).items({ take: first });
}
Dan M
05/04/2021, 8:35 PMType '{ _count: { select: { initialLadderAppearances: true; }; }; }' is not assignable to type 'MemberInclude'.
Object literal may only specify known properties, and '_count' does not exist in type 'MemberInclude'.ts(2322)
I just verified that I generated my Prisma client using 2.22.0, and I reloaded VSCode. _count
doesn't seem to exist anywhere 🤷♂️🤷♂️🤷♂️
Here's the relevant code snippet:Liam Potter
05/06/2021, 9:52 AMnpx prisma db push --preview-feature --force-reset
from the js PrismaClient? I want to use it to clear my database after I run tests.
I suppose I can always use spawn to run the command but if there is a js way to achieve the same thing I’d prefer that.sakulstra
05/12/2021, 2:27 PMMongoClient
via prisma client for doing things like complex aggregations or bulks?Kerem Kazan
05/12/2021, 3:26 PMmodel Member {
id Int @id @default(autoincrement())
email Email
}
the Email
type would be coming from typescript. If modifying the schema like above is not possible/recommended, is it at least possible to have this type appear on the generated client types? i’d want all prisma methods on the Member
type to expect the email field to be of type Email
, not just string
afeurra
05/14/2021, 7:37 AMconst room = await prisma.room.findUnique({ where: { id: roomId } })
room.messages // what type should I declare this in order to edit it?!
James
05/15/2021, 7:58 PMrm -rf node_modules/ ; pnpm i
And restart the TS server, I loose all my type info, it becomes type 'any'
rm -rf node_modules/ ; yarn
And restart the TS server, and I get my type info backLiam Potter
06/03/2021, 2:17 PMdb push
is all of a sudden giving me this error
Response: Database `mydb-test.public` does not exist on the database server at `localhost:5432`.
this used to be fine, the docs state db push
will create the database if the database does not exist, so I’m not sure why this is now happening?Liam Potter
06/03/2021, 2:19 PMParker Lawrence
06/03/2021, 4:33 PMincludes
? For example, suppose I have a query like this:
prisma.user.findUnique({
where: { id },
include: {
post: true
},
});
and I want to create a type for the result leveraging the Prisma generated types. something along the lines of this (I’ve just made up the Includes
helper tho):
import { User, Post } from '.prisma/client';
type UserWithPosts = Include<User, Post>;