https://www.prisma.io/ logo
Join SlackCommunities
Powered by
# prisma-client
  • j

    James Lee

    06/05/2021, 10:56 AM
    Multi model schema question https://github.com/prisma/prisma/issues/2443#issuecomment-855222032
  • m

    Michael

    06/08/2021, 3:26 PM
    Hey Volks! Is it best practise to query multiple data from an array of ids? As an input I got several ids which should query all data based on the ids. In Prisma you have findMany but as an input, having an array is not really best practise, is it? For Example I got an Input of an Array of ids => and in Prisma should do something like
    args: [{id: "123"}, {id: "345}]
    prisma.model.findMany({
    where: {…}
    })
    d
    • 2
    • 4
  • p

    phapha

    06/12/2021, 2:38 AM
    Is there any way to avoid having to prefix the implicit many-to-many table name with an underscore? I'm trying to migrate our TypeORM codebase and this is being an issue... I would rather not make any changes to the schema as I'm planning a gradual migration. I've tried creating a view on the database with the desired name, but that doesn't seem to be enough...
    • 1
    • 1
  • m

    Mitchell Amihod

    06/17/2021, 2:12 AM
    Hi. Q: Started seeing this sometimes, not sure if something has changed in prisma recently that this error wouldnt be handled?
    Copy code
    This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
    Error: Can't reach database server at `my-host-here`:`5432`
    Please make sure your database server is running at `my-host-here`:`5432`.
        at LineStream.<anonymous> (/app/node_modules/@prisma/client/runtime/index.js:27666:31)...
    Prisma client 2.25.0 // Any advice how I should handle this? Using it in the context of nestjs? is there a way to configure a retry with prisma client?
    r
    j
    • 3
    • 14
  • m

    Mitchell Amihod

    06/17/2021, 2:13 AM
    I do a
    Copy code
    await this.$connect(); (this being the prisma client)
  • m

    Mitchell Amihod

    06/17/2021, 2:19 AM
    reading the docs, but not seeing anything about retires
    j
    • 2
    • 3
  • t

    Tony Vi

    06/17/2021, 8:39 PM
    Hi, there! 👋 Can anybody helps me to understand how sort in includes works So, I have resolver with a
    prisma-client
    (
    v2.23.0
    ) call. Here I'm trying to sort included issues. But nothing happens. Any kind of sort doesn't have effect.
    Copy code
    @Query(() => Queue, { nullable: true })
        async queueByKey(@Arg('key', () => String) key: string, @Ctx() ctx: Context) {
            return ctx.prisma.queue.findUnique({
                where: { key },
                include: {
                    issues: {
                        orderBy: {
                            createdAt: 'desc',
                        },
                    },
                },
            });
        }
    Thanks for the any suggestion! 🙏
    🙏 1
    r
    • 2
    • 8
  • t

    Torrino

    06/24/2021, 3:31 PM
    When I run
    prisma generate
    my prisma/client is generated as version 2.21.2 even though I updated my packages. Can't find the issue, would appreciate help 😔 EDIT: My prisma client in the node modules folder is version 2.21.2 even though that version number isn't present anywhere in the package.json or package-lock.json files.
    r
    j
    • 3
    • 11
  • t

    Torrino

    06/26/2021, 10:27 AM
    Is it possible to use a custom type for a Model field? I know you can use enums for example but what if my custom type is in another typescript file? Or, what if I need to use the enum created in the prisma schema in my other files for certain data validation?
  • p

    Pierre Ortega

    06/26/2021, 8:22 PM
    @Torrino you can always export the enum created by Prisma from the generate type files
    t
    a
    r
    • 4
    • 5
  • i

    iamtheworstdev

    06/28/2021, 1:58 AM
    yea i'm just gonna delete my question out of embarassment lol
    m
    d
    • 3
    • 4
  • i

    iamtheworstdev

    06/28/2021, 7:30 PM
    is there a limit to the number of elements one can put in a createMany call?
    d
    r
    • 3
    • 10
  • p

    Paul T

    06/28/2021, 9:13 PM
    Hi there, I could use some help with two models that have a many to many relationship (generated implicitly). If I have a existing records of the two models, and I try to connect one with the other, I am getting unkown arg errors for the model I am trying to connect.
    Copy code
    const events = await prisma.event.findMany()
    await Promise.all(events.map(async e) => {
       const performers = await prisma.performer.findMany({ where: ..logicToFindPerformers });
       await prisma.event.update(
         { 
            where: { id: e.id }, 
            data: { performers: performers.map((p) => ({ id: p.id })) }
         }
       )
    })
    But I am getting this error message from the client:
    Unknown arg 'performers' in data.performers for type EventUncheckedUpdateInput.
    I can see from my generated schema that I do have a join table created (
    _EventToPerformer
    ), so what is the correct way to join existing records in a many to many relationship?
    r
    • 2
    • 2
  • b

    Bernd Münzer

    06/29/2021, 12:00 PM
    Hi all, I't trying to package a node.js application that uses prisma into a single executable file, but I am having problems with the prisma client. It seems that the client binary is not found within the .exe or for some reason doesn't work. I tried it with https://github.com/vercel/pkg as well as https://github.com/nexe/nexe, but with the same result. Does anyone have experiences with this and maybe has a hint?
    j
    • 2
    • 16
  • r

    Ridhwaan Shakeel

    06/29/2021, 4:05 PM
    does anyone know how to create multiple records of a nested relation while creating one record of another relation?
  • r

    Ridhwaan Shakeel

    06/29/2021, 4:05 PM
    using upsert or connectOrCreate
  • j

    Jamey Nakama

    06/29/2021, 5:22 PM
    On updating from 2.23 to 2.26, I’m getting
    Copy code
    #11 51.92 ✔ Installed the @prisma/client and prisma packages in your project
    #11 51.92 Error: Could not resolve @prisma/client.
    #11 51.92 Please try to install it with npm install @prisma/client and rerun prisma generate 🙏.
    That might not be enough to know what’s going on, due to our own setup, but changing nothing but the version makes our builds fail. Does anything stand out to anyone based on the versions?
    j
    r
    • 3
    • 18
  • j

    Jamey Nakama

    06/29/2021, 5:23 PM
    I’ve got
    @prisma/client
    as a normal dependency (not dev)
  • i

    iamtheworstdev

    06/30/2021, 5:48 PM
    is there a reason why Prisma defaults table names to capital letters ? like model User {} creates table User? That naming structure is explicitly shunned by postgres
    r
    j
    • 3
    • 7
  • r

    Ridhwaan Shakeel

    06/30/2021, 11:16 PM
    I am looking for prisma developers to check on a schema and prisma client not performing create as expected
    v
    r
    • 3
    • 4
  • r

    Ridhwaan Shakeel

    06/30/2021, 11:16 PM
    if you have vs code with liveshare thats great
  • m

    Maotora

    07/01/2021, 11:26 PM
    Hello everyone
  • m

    Maotora

    07/01/2021, 11:27 PM
    I have an issue here, when I enter
    prisma generate
    I get
    Copy code
    TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
        at validateString (internal/validators.js:124:11)
        at Object.join (path.js:1148:7)
        at getDotPrismaDir (/home/ubuntu/app/nexus-app/node_modules/@prisma/client/generator-build/index.js:73072:33)
        at Object.generateClient (/home/ubuntu/app/nexus-app/node_modules/@prisma/client/generator-build/index.js:73094:49)
        at Object.onGenerate (/home/ubuntu/app/nexus-app/node_modules/@prisma/client/generator-build/index.js:78382:34)
        at LineStream.<anonymous> (/home/ubuntu/app/nexus-app/node_modules/@prisma/client/generator-build/index.js:2802:40)
        at LineStream.emit (events.js:375:28)
        at addChunk (internal/streams/readable.js:290:12)
        at readableAddChunk (internal/streams/readable.js:265:9)
        at LineStream.Readable.push (internal/streams/readable.js:204:10)
    j
    • 2
    • 2
  • p

    Patrick Ayres

    07/02/2021, 8:26 PM
    Hi all,
  • p

    Patrick Ayres

    07/02/2021, 8:29 PM
    I've been running into stack exceptions during type checking and seeing some type errors about possibly infinite types in my Prisma client. Has anyone experienced this before? I'm trying to troubleshoot whether it is a problem in my schema or something in Prisma Client itself... partial example error:
    Copy code
    Type of property 'AND' circularly references itself in mapped type...
    • 1
    • 1
  • g

    Gautam Paranjape

    07/07/2021, 5:40 AM
    Why am I getting this error during a create operation? I have supplied all the data needed
    r
    • 2
    • 4
  • s

    Sting Alleman

    07/07/2021, 9:20 PM
    Hi, I heard that Prisma is not really optimized. People are saying that Prisma runs an unnecessary number of queries, and that it doesn't multiple DB connections. Is this going to be fixed and will things like DB pagination be supported in the future?
    j
    d
    • 3
    • 2
  • k

    koufatzis

    07/09/2021, 4:28 PM
    Hello to all. I have a question about the documentation. Where can I find the return type of the CRUD methods for example
    create
    if something fails. I see only the return type of the happy case documented on the prisma website.
    r
    • 2
    • 2
  • m

    Mattèo Gauthier

    07/12/2021, 6:10 PM
    Hey everyone hope you're doing well ! I wanted to know if someone know how to generate Typescript Types from Prisma schema 🙂
    r
    • 2
    • 1
  • r

    Ridhwaan Shakeel

    07/13/2021, 1:16 PM
    It would be nice to see multiple WHERE, AND conditions get supported by prisma 2 queries. for non-unique values
    r
    • 2
    • 2
1...8910...23Latest