https://www.prisma.io/ logo
Join Slack
Powered by
# orm-help
  • i

    Ilkka Huotari

    09/01/2022, 9:42 PM
    Why can't I get the
    @relation
    object type appear in the editor (VS Code), when using TypeScript and the query has
    include: { user: true }
    ...? It will work on the actual app when running it, but the editor doesn't realize the type should be there.
    โœ… 1
    n
    • 2
    • 5
  • t

    Tejas H

    09/02/2022, 3:03 AM
    Hey folks, https://www.prisma.io/docs/ isn't working.
    โœ… 1
    n
    • 2
    • 2
  • l

    Lewis

    09/02/2022, 5:45 AM
    I'm genuinely beyond lost; I've checked out the docs and just can't figure out how to work with Json object arrays. This is my model (postgresql):
    Copy code
    model FishInventory {
      id            String @id @unique
      fishInventory User?  @relation(fields: [id], references: [id], onDelete: Cascade)
      fish          Json
    }
    This is the data structure in the database:
    Copy code
    [{"name": "bass", "amount": 1}, {"name": "salmon", "amount": 1}]
    This is something I've tried as shown on the docs:
    Copy code
    const user = await prisma.fishInventory.findFirst({
       where: {
          id: "10",
          fish: {
             path: ["name"],
             equals: "bass"
          },
       },
    })
    That returns null ^, not quite sure why. If someone could show me how I am able to fully manipulate that data (adding, updating, and removing particular objects by "name" from that array and also being able to change the "amount"), that would be a massive help. I've been trying various methods for hours now and just can't figure it out!
    ๐Ÿ‘€ 1
    โœ… 1
    r
    • 2
    • 4
  • d

    David Hancu

    09/02/2022, 1:45 PM
    ๐Ÿ‘‹ Hi everyone! I've been working on a CLI tool (releasing tomorrow) that allows merging of multiple schema files and I was wondering if you'd be interesting in generating schema files from your code! I know, it sounds like an alien concept, but basically create schema files using a JavaScript (and TypeScript for that matter) API that get ran before you use any Prisma commands. Please let me know if this is a feature that you'd personally use, so I can look into improving the CLI.
    n
    • 2
    • 3
  • a

    Austin Conder

    09/02/2022, 3:20 PM
    Hey, I understand that prisma client does not support triggers. Does that also mean that manually adding triggers to a database would negatively affect the prisma client, or we can manually add our own triggers?
    โœ… 1
    n
    • 2
    • 1
  • j

    Jan Jagriฤ

    09/02/2022, 3:33 PM
    Hello, it is my first time using Prisma on a prototype project. I am developing my API server with Node.js Express and Prisma with MySQL. I am done with my local development. Now I am deploying my project on cPanel web hosting as Node.js application for further development and testing. Database migration is done. Server is running. Now the only problem is an error all my REST endpoints are returning:
    Unable to load Node-API Library from /home/tobakz13/surapi/src/generated/client/libquery_engine-debian-openssl-1.1.x.so.node, Library may be corrupt.
    I am looking for some pointers on how to solve this problem as I am not a server knowhow or prisma expert yet. My standard google research left me with no success. I thank you all in advance and have a nice weekend.
    โœ… 1
    n
    v
    • 3
    • 10
  • c

    Christoffer

    09/02/2022, 5:32 PM
    Does anyone have a clue why prisma studio is complaining about invalid JSON? I used JSON.stringify to convert a created object from prisma, and it complains about "Value must be a valid Json" in prisma studio
    โœ… 1
    r
    • 2
    • 3
  • w

    William GM

    09/02/2022, 6:20 PM
    Hello Getting this error using a Gist index I thought they where supported since version 4? Any ideas how to overcome this?
    ๐Ÿ‘€ 1
    n
    v
    • 3
    • 3
  • f

    Franklin

    09/02/2022, 7:32 PM
    Hello, I have a table and I want to make updatedBy and createdBy a one to many relationship with the user table.
    Copy code
    model AssetCollection {
      id          Int        @id @default(autoincrement())
      department  String?    @db.VarChar(50)
      reviewed    String?    @db.VarChar(50)
      createdAt   DateTime   @default(now())
      updatedAt   DateTime   @updatedAt
      createdBy   Int        
      updatedBy   Int       
      locationId  String
      caseBarcode String
      prep        Int
      assetCount  Int
      currStatus  String?
      bayLocation String?
      assetEquip  AssetEquip @relation(fields: [caseBarcode], references: [barId], onDelete: Cascade)
      location    Location   @relation(fields: [locationId], references: [locNum], onDelete: Cascade)
      assetPrep   AssetPrep  @relation(fields: [prep], references: [id], onDelete: Cascade)
    }
    ๐Ÿ‘€ 1
    n
    v
    • 3
    • 2
  • d

    David Hancu

    09/02/2022, 7:45 PM
    Hi everyone! Quick update on the utility CLI: I've been working on releasing it on NPM and it's scheduled to release tomorrow at 19:30 UTC. I've also prepared a proposal there so you can vote on the new implementation of code generated schemas for Prisma. I'll post an update in #showcase with the download link and the link to the proposal once the package goes live.
    โœ… 1
    n
    • 2
    • 1
  • m

    Matt

    09/02/2022, 7:56 PM
    Hello everyone, is there a good place to discuss writing a connector for a new database? specifically looking to implement one for firestore
    โœ… 1
    d
    n
    h
    • 4
    • 4
  • b

    Boo

    09/02/2022, 8:55 PM
    does prisma do any sort of comparison checks for
    .update
    ? meaning, if value is the same, does it still run the query?
    โœ… 1
    n
    • 2
    • 1
  • h

    howdysourav

    09/03/2022, 9:46 AM
    Hey, y'all ๐Ÿ‘‹ A quick question, though it's not directly linked to Prisma. I'm trying to wrap a REST API with GraphQl, I'm using Graphql Yoga. So I have an endpoint
    /ideas
    that returns a response that looks like this:
    Copy code
    {
      "status": true,
      "message": "All ideas",
      "data": [
        {
          "id": 57,
          "title": "a demo title",
          "description": "a demo description",
          "creatorId": "0xF95f8038Eb7874Cde88A0A9a8270fcC94f5C226e",
          "votecount": 1,
        },
        {
          "id": 23,
          "title": "a demo title",
          "description": "a demo description",
          "creatorId": "0xF95f8038Eb7874Cde88A0A9a8270fcC94f5C226e",
          "votecount": 8,
        },
      ]
    }
    I want to implement a filter for the votecount field for a value greater than a given value. Can anyone please help here?
    โœ… 1
    s
    • 2
    • 3
  • d

    David Hancu

    09/03/2022, 11:27 AM
    ๐Ÿ‘‹ Hi everyone! I've got a new feature idea for the Prisma CLI I've been talking about and I was wondering if you would be interested in it: loading
    DATABASE_URL
    from another source rather than the
    .env
    file (like a YAML file). Let me know if this is something you'd like to see!
    ๐Ÿ‘€ 1
    โœ… 1
    s
    • 2
    • 2
  • y

    yuno dream

    09/03/2022, 3:09 PM
    Quick question. When creating/updating/removing records, should you make a query before to check if the record already exists, or should that be handled with error codes in catch?
    โœ… 1
    h
    • 2
    • 1
  • g

    Gumnaam Haikoi

    09/03/2022, 4:05 PM
    Hi all. I'm fairly new to everything in general. Trying to write a resolver for this query (using Graphql and Nestjs with Prisma) to filter through
    gigs
    . I want the entire
    OR
    part to run only if the
    filter
    argument has been passed to this query since right now, executing the query without any arguments does not list all the
    gigs
    . I know it must be a trivial thing, but I'm stuck at it since quite a while. Help please!
    @Query()
    async gigs(
    @Args('title') title: string,
    @Args('published') published: boolean,
    @Args('filter') filter: string,
    ): Promise<Gig[]> {
    return this.gigService.gigs({
    where: {
    title: title,
    published: published,
    OR: [
    { title: { contains: filter, mode: 'insensitive' } },
    { description: { contains: filter, mode: 'insensitive' } },
    ],
    },
    });
    }
    ๐Ÿ‘€ 1
    h
    v
    • 3
    • 9
  • d

    David Hancu

    09/03/2022, 6:20 PM
    Hi people! Just a quick reminder that the utility CLI I've talked about is releasing in 1 hour, along with a proposal for code-generated schemas and a proposal for loading data using other sources (such as YAML). I'll provide the links in #showcase when it's ready to be used!
    โœ… 1
    n
    • 2
    • 1
  • j

    Jonathan Marbutt

    09/04/2022, 9:17 PM
    I am a little behind on the multi-schema stuff that has been announced in preview, but can it generate the prisma schema file from an existing db?
    โœ… 1
    s
    • 2
    • 1
  • s

    Shannon Smith

    09/05/2022, 12:04 AM
    Hi All. Iโ€™m new around here hand have question. When I look at my types i see, for example, types like this - PassUncheckedUpdateInput, PassUpdateInput. What is the use case for the two of these. i.e what is an โ€œuncheckedโ€ input?
    โœ… 1
    n
    • 2
    • 1
  • o

    Ozzy Cardenas

    09/05/2022, 1:23 AM
    Hey y'all. I'm new to prisma and looking to spin up a project management app using nextjs. I'm hoping to get some advice in a DB service that works well with prisma? I'm seeing a ton of options. Planetscale? Heroku? Render? Supabase?
    โœ… 1
    s
    s
    v
    • 4
    • 3
  • r

    Rob

    09/05/2022, 4:02 AM
    hi, I have a bigInt field and it keeps getting appended with an 'n'... It's an integer, so Im not sure how this is even possible. Any good explanation?
    โœ… 1
    b
    n
    • 3
    • 2
  • j

    Jared Fraser

    09/05/2022, 4:08 AM
    The
    n
    represents it's being cast to a
    BigInt
    plus one +1 1
    • 1
    • 4
  • v

    Vignesh T.V.

    09/05/2022, 6:56 AM
    Noticed a bug with Prisma throwing errors. Reported here: https://github.com/prisma/prisma/issues/15180 Critical to be addressed since these are breaking the way we used to catch errors
    โœ… 1
    ๐Ÿ™ 1
    n
    • 2
    • 1
  • m

    Maksi

    09/05/2022, 9:08 AM
    hey, I am new to slack. is this the right channel for help?
    ๐Ÿ‘€ 1
    r
    v
    • 3
    • 14
  • t

    Taylor Lindores-Reeves

    09/05/2022, 12:20 PM
    Christ almighty
  • t

    Taylor Lindores-Reeves

    09/05/2022, 12:20 PM
    This is frustrating
  • t

    Taylor Lindores-Reeves

    09/05/2022, 12:21 PM
    I am following the Prisma query structure perfectly
  • t

    Taylor Lindores-Reeves

    09/05/2022, 12:21 PM
    `Did you mean
    is
    ?`
  • t

    Taylor Lindores-Reeves

    09/05/2022, 12:24 PM
    Yes, I meant
    is
    - proceeds to add
    is
    and then get `Unknown arg
    is
    in where.OR.0.Auction.is for type AuctionWhereInput.`
    โœ… 1
  • t

    Taylor Lindores-Reeves

    09/05/2022, 12:25 PM
    I can record a video
1...616617618...637Latest