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

    Oliver

    08/04/2022, 3:42 PM
    Hello everyone! I am thinking about creating an audit log. Whenever a customer does a CRUD operation it is logged in the DB with a model called
    AuditLogEntry
    . Im not sure this is 100% Prisma related but I'm curious if you believe this is viable? Specifically, I wonder if it will be too much data if a few hundred users click around all day and create
    AuditLogEntry
    everytime they load a page (read from a table), which they will do rather often. Thanks! EDIT: This is how I imagine the model to look like, to give an idea of the data size:
    Copy code
    model AuditLogEntry {
      id          String   @id @default(cuid())
      createdAt   DateTime @default(now()) @map("created_at")
      authorId    String   @map("author_id")
      author      User     @relation(fields: [authorId], references: [id], onDelete: Cascade)
      patient     Patient? @relation(fields: [patientId], references: [id], onDelete: Cascade)
      patientId   String?  @map("patient_id")
      subject     Subject?
      action      Action?
      title       String
      description String
    
      @@map("audit_log_entries")
    }
    βœ… 1
    n
    l
    n
    • 4
    • 4
  • m

    Michael Jay

    08/04/2022, 6:15 PM
    I want to provide an update for anyone that may have been following along with my Docker/Prisma saga. I blew away nearly the whole Dockerfile and went completely bare-bones. Namely, I threw away the multi-step build. I just had to figure out if I was going to be able to make Prisma work at all. I am now successfully running a container locally - on to Cloud Run. When I put out all the fires that cropped up while I was trying to transition us to Prisma, I plan on really sitting down, learning the lessons, and even writing them up so someone else might benefit from my labor. Cheers, Prisma.
    πŸš€ 2
    a
    n
    • 3
    • 3
  • j

    Jeremy H

    08/04/2022, 7:49 PM
    All of a sudden today I'm getting this error over and over again:
    Copy code
    prisma:error Error while querying: This request must be retried
    prisma:warn This request can be retried
    prisma:warn Retrying after 55ms
    βœ… 1
    m
    i
    • 3
    • 11
  • j

    Jeremy H

    08/04/2022, 8:33 PM
    Wow I'm dumb ... I think I fixed it.
  • j

    Jeremy H

    08/04/2022, 8:33 PM
    I had used a triple slash
    ///
    in my Schema file
    πŸ”₯ 1
  • s

    Schalk Neethling

    08/04/2022, 9:21 PM
    Hey All, I am following the example here https://www.prisma.io/docs/guides/testing/unit-testing#singleton but when running the tests I am getting
    TypeError: mock.mockReset is not a function
    - I also initially ran into the problem of
    jest
    not being defined but I resolved that with
    import { jest } from "@jest/globals";
    Copy code
    beforeEach(() => {
      mockReset(prismaMock);
    });
    • 1
    • 3
  • c

    Chris Tsongas

    08/03/2022, 11:16 PM
    Recommendations in regards to setting Prisma's pool size? We're on Render and our Postgres plan includes 97 connections. Just learned the hard way that setting the pool size close to 97 is NOT a good idea because devs also need some of those connections for using SQL clients. Just wondering if we should set the pool size as high as possible while leaving plenty of connections free for devs i.e. 70 out of 97 available, or is there some downside to that maybe in terms of RAM usage by either Postgres or Prisma Client? We're running Apollo Server on Node.
    βœ… 1
    n
    d
    • 3
    • 5
  • i

    Ivan Lukianchuk

    08/05/2022, 12:42 AM
    So seems like Data Proxy did something funny an hour ago and started causing all my queries to fail and took down my production site during it's busiest time, so much wasted traffic and potential customers :(
    j
    • 2
    • 1
  • h

    Hayley Dawson

    08/05/2022, 12:44 AM
    Hello folks. I’m running into an issue with a select on a relation. It appears to be the same one as documented here https://github.com/prisma/prisma/discussions/14523 but I cannot find anything on github tracking this as an issue or potential workarounds if it’s related to schema generation. changing our queries wont work for our case we have some generated deeply nested/dynamic items. Any help would be appriciated.
    βœ… 1
    a
    • 2
    • 7
  • s

    sagar lama

    08/05/2022, 5:12 AM
    I'm getting type error on group by inside a transaction query, Is this not allowed or not recommended? Do I need to run a separate query to resolve this?
    j
    • 2
    • 2
  • n

    Nadeshi Kon

    08/05/2022, 7:22 AM
    Hi, does anyone know if it's possible to filter a string array with "contains"
  • n

    Nadeshi Kon

    08/05/2022, 7:22 AM
    like it matches when any of the string element contains the query
  • n

    Nadeshi Kon

    08/05/2022, 7:22 AM
    I tried hasSome but it only matches when any element completely matches with the string
    βœ… 1
    n
    • 2
    • 2
  • n

    Nabhag Motivaras

    08/05/2022, 8:27 AM
    Hey! My name is Nabhag, from India. I'm Student currently pursuing my Bachelors in Computer Science. I was Learning about Prisma and I absolutely loved it!! I am here to collaborate with y'all and contribute to project in anyway. I am hoping to learn about working in OSS and improve my soft skills while learning about ORM development.
    prisma rainbow 2
    india parrot 2
    πŸ‘‹ 3
    πŸ’š 3
    n
    n
    • 3
    • 2
  • s

    sagar lama

    08/05/2022, 8:28 AM
    I'm getting a type error when apyying on prisma group by
    jest.spyOn(prismaService.authProvider, 'groupBy').mockResolvedValue([]);
    Error
    Copy code
    Type of property 'AND' circularly references itself in mapped type '{ [K in keyof { AND?: Enumerable<AuthProviderScalarWhereWithAggregatesInput>; OR?: Enumerable<AuthProviderScalarWhereWithAggregatesInput>; ... 4 more ...; userId?: number | IntWithAggregatesFilter; }]: Or<...> extends 1 ? { ...; }[K] extends infer TK ? GetHavingFields<...> : never : {} extends FieldPaths<...> ? neve...'.ts(2615)
    How do I solve this?
    βœ… 1
    πŸ‘€ 1
    r
    • 2
    • 2
  • t

    Tanuj Doshi

    08/05/2022, 12:09 PM
    Hello there i have a small doubt i am using nest js with prisma i wanted to know that how can i manage includeDeleted flag for any table i want all users data, and i have used soft delete middleware as discussed Here
    βœ… 1
    n
    m
    • 3
    • 3
  • m

    Michael Jay

    08/05/2022, 12:11 PM
    I'm continuing to get this Prisma initialization error - "Prisma can't connect to db at <ip>:<port>". I'm now following this URL string name as best as I can - from the Prisma docs: https://www.prisma.io/docs/concepts/database-connectors/postgresql#connecting-via-sockets With one exception. for the host param, I'm percent-encoding the slashes. So I'm putting in:
    <postgresql://MYUSER:MYPW@localhost/MYDB?host=%2Fcloudsql%2FMY_CLOUD_SQL_INSTANCE_CONNECTION_NAME%2F>
    I tried it with and without the trailing slash, but I haven't tried it yet with removing the percent encodings. I just would really love to hear from a Prisma team member that this is up-to-date information so I can rule one thing out and focus elsewhere.
    βœ… 1
    n
    • 2
    • 4
  • j

    Jigar Bhaliya

    08/05/2022, 12:24 PM
    How i would get all records of soft delete applied model?
    plus one +1 1
    βœ… 1
    m
    n
    • 3
    • 5
  • s

    Slackbot

    08/05/2022, 1:09 PM
    This message was deleted.
    n
    • 2
    • 1
  • u

    user

    08/05/2022, 2:13 PM
    πŸ‘‰ Daniel Starns - Looking ahead with GraphQL - GraphQL Berlin Meetup #26 --

    https://www.youtube.com/watch?v=iWGpTvSr-1Eβ–Ύ

    -- Daniel Starns, Software Developer at Prisma, explains how Prisma fits into GraphQL ecosystem. Connect with Dan: https://twitter.com/dan_starns This talk has been recorded during the GraphQL Berlin Meetup #26. Join our Meetup group here: https://www.meetup.com/graphql-berlin/
    graphql 2
    prisma rainbow 3
  • s

    Schalk Neethling

    08/05/2022, 7:15 PM
    Has anyone gotten the unit testing guide working with the latest version of Jest and jest-mock-extended? https://www.prisma.io/docs/guides/testing/unit-testing
    βœ… 1
    n
    • 2
    • 10
  • s

    Schalk Neethling

    08/05/2022, 7:42 PM
    @Rich ^^
  • s

    Schalk Neethling

    08/05/2022, 7:44 PM
    It does not look like a ton changed between 2.0.4 and 2.0.7 other than a few bug fixes and support added for Jest 28
  • s

    Schalk Neethling

    08/05/2022, 7:44 PM
    Perhaps it is something in Jest 28 that is the source of the problem
  • m

    Manuel

    08/05/2022, 8:48 PM
    Hi, I'm having a weird problem when trying to connect to a managed Postgrs database on Digitalocean from a Docker container (running in a Kubernetes cluster on Digitalocean). Prisma is not ablte to find the cert file. My connection string looks like this:
    DATABASE_URL=<postgresql://username:password@project-do-user-xxxxxx-0.b.db.ondigitalocean.com>:xxxxxx/xxxxxx?sslmode=require&sslcert=ca-certificate.crt&pgbouncer=true
    ca-certificate.crt is preseent in the container at the right location (prisma folder) and locally as well as on a DO droplet without Docker everything is working fine with exactly the same connection string. Not really sure what the problem is here, maybe anyone might have an idea?
    βœ… 1
    j
    n
    • 3
    • 8
  • z

    Zac Webb

    08/05/2022, 11:32 PM
    Hey all, Anyone have much experience with unit testing prisma rainbow relations in Jest? Trying to mock a
    User
    ->
    Profile
    relation but having trouble getting the data back I'm expecting πŸ€” Does this look at all correct in terms of creating the connection between the two models? The response I'm getting from the service I'm unit testing doesn't include any information about the
    User
    ...
    πŸ‘€ 1
    n
    • 2
    • 1
  • b

    Blake Puls

    08/06/2022, 1:52 AM
    Hello, I've been learning Prisma and it's all been going well, I really enjoy it. However, I've been stuck on one single problem - creating/updating deeply related nested. Here is my schema. I'm wanting to push a new ShopItem but I don't know the CRUD for it!
    πŸ‘€ 1
    n
    • 2
    • 1
  • a

    Adimac93

    08/06/2022, 11:24 PM
    I've added this to
    package.json
    Copy code
    "prisma": {
    		"seed": "ts-node ./src/lib/database/seed.ts"
    	},
  • a

    Adimac93

    08/06/2022, 11:25 PM
    And now on every db connection it's seeding I guess
  • a

    Adimac93

    08/06/2022, 11:26 PM
    As you can see I have CLI option to seed db or as mentioned in documentation by using
    npx prisma db seed
1...604605606...637Latest